-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add _dd.tracer_host to local root spans (#7426)
- Loading branch information
Showing
5 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
dd-trace-core/src/main/java/datadog/trace/core/tagprocessor/RemoteHostnameAdder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package datadog.trace.core.tagprocessor; | ||
|
||
import datadog.trace.api.Config; | ||
import datadog.trace.api.DDTags; | ||
import datadog.trace.core.DDSpanContext; | ||
import java.util.Map; | ||
|
||
public class RemoteHostnameAdder implements TagsPostProcessor { | ||
private final Config config; | ||
|
||
public RemoteHostnameAdder(Config config) { | ||
this.config = config; | ||
} | ||
|
||
@Override | ||
public Map<String, Object> processTags( | ||
Map<String, Object> unsafeTags, DDSpanContext spanContext) { | ||
if (spanContext.getSpanId() == spanContext.getRootSpanId()) { | ||
unsafeTags.put(DDTags.TRACER_HOST, config.getHostName()); | ||
} | ||
return unsafeTags; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters