Skip to content

Commit

Permalink
Merge branch 'apache:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Z-Beatles authored Oct 7, 2023
2 parents c5e2910 + f25e660 commit 2636b9a
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,20 @@ while (next.hasNext()) {
...

```
note: Inject can be done only in Exit Span

```java
// Receive the map representing a header/metadata and do the extract operation in another process.
...

ContextCarrierRef contextCarrierRef = new ContextCarrierRef();
CarrierItemRef next = contextCarrierRef.items();
for (Map.Entry<String, String> entry : map.entrySet()) {
if (next.hasNext()) {
next = next.next();
if (entry.getKey().equals(next.getHeadKey()))
next.setHeadValue(entry.getValue());
}
while ((next.hasNext())) {
next = next.next();
String value = map.get(next.getHeadKey());
if (value != null){
next.setHeadValue(value);
}
}
Tracer.extract(contextCarrierRef);
```
Expand All @@ -106,12 +107,12 @@ while (next.hasNext()) {

ContextCarrierRef contextCarrierRef = new ContextCarrierRef();
CarrierItemRef next = contextCarrierRef.items();
for (Map.Entry<String, String> entry : map.entrySet()) {
if (next.hasNext()) {
next = next.next();
if (entry.getKey().equals(next.getHeadKey()))
next.setHeadValue(entry.getValue());
}
while ((next.hasNext())) {
next = next.next();
String value = map.get(next.getHeadKey());
if (value != null){
next.setHeadValue(value);
}
}
SpanRef spanRef = Tracer.createEntrySpan("${operationName}", contextCarrierRef);
```
Expand Down

0 comments on commit 2636b9a

Please sign in to comment.