This repository has been archived by the owner on Jul 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 232
Enable process level tags to be associated with the tracer #143
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,8 @@ private Tracer( | |
Sampler sampler, | ||
PropagationRegistry registry, | ||
Clock clock, | ||
Metrics metrics) { | ||
Metrics metrics, | ||
Map<String, Object> tags) { | ||
this.serviceName = serviceName; | ||
this.reporter = reporter; | ||
this.sampler = sampler; | ||
|
@@ -89,7 +90,6 @@ private Tracer( | |
|
||
this.version = loadVersion(); | ||
|
||
Map<String, Object> tags = new HashMap<String, Object>(); | ||
tags.put("jaeger.version", this.version); | ||
String hostname = getHostName(); | ||
if (hostname != null) { | ||
|
@@ -326,6 +326,7 @@ public static final class Builder { | |
private Metrics metrics; | ||
private String serviceName; | ||
private Clock clock = new SystemClock(); | ||
private Map<String, Object> tags = new HashMap<String, Object>(); | ||
|
||
public Builder(String serviceName, Reporter reporter, Sampler sampler) { | ||
if (serviceName == null || serviceName.trim().length() == 0) { | ||
|
@@ -370,8 +371,23 @@ Builder withMetrics(Metrics metrics) { | |
return this; | ||
} | ||
|
||
Builder withTag(String key, String value) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be public. I will change it in #142 in order to test it when corverting to thrift model. |
||
tags.put(key, value); | ||
return this; | ||
} | ||
|
||
Builder withTag(String key, boolean value) { | ||
tags.put(key, value); | ||
return this; | ||
} | ||
|
||
Builder withTag(String key, Number value) { | ||
tags.put(key, value); | ||
return this; | ||
} | ||
|
||
public Tracer build() { | ||
return new Tracer(this.serviceName, reporter, sampler, registry, clock, metrics); | ||
return new Tracer(this.serviceName, reporter, sampler, registry, clock, metrics, tags); | ||
} | ||
} | ||
|
||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to create a new map and add all tags from the parameter
tags
, rather than taking the ownership of the map created outside of the constructor.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, never mind, the map is owned by the builder, so it's fine