-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds support for agent level tag #1396
Conversation
cmd/agent/app/reporter/flags.go
Outdated
} | ||
|
||
// AddFlags adds flags for Options. | ||
func AddFlags(flags *flag.FlagSet) { | ||
flags.String(reporterType, string(GRPC), fmt.Sprintf("Reporter type to use e.g. %s, %s", string(GRPC), string(TCHANNEL))) | ||
flags.String(agentTags, "", fmt.Sprintf("Add agent-based tags. Ex: --jaeger.tags key1=value1,${envVar:defaultValue}")) |
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.
what does ,${envVar:defaultValue}
mean?
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.
Copied over from https://github.com/jaegertracing/jaeger-client-go/blob/c58709fe19d793cdd40ad8bfa6e645a40a2eccf8/config/config_env.go#L195-L199 -
// parseTags parses the given string into a collection of Tags.
// Spec for this value:
// - comma separated list of key=value
// - value can be specified using the notation ${envVar:defaultValue}, where `envVar`
// is an environment variable and `defaultValue` is the value to use in case the env var is not set
func addAgentTags(spans []*model.Span, agentTags []model.KeyValue) []*model.Span { | ||
for _, span := range spans { | ||
for _, tag := range agentTags{ | ||
span.Tags = append(span.Tags, tag) |
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.
top-level question for the PR: should these be added to Span tags or Process tags?
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.
It might depend. For example in k8s we support deploying agent as a side-car but also as daemon set (1 agent per k8s node).
I think we would need an additional flag to be able to add it to process tags
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 we would need an additional flag to be able to add it to process tags
Is this the consensus?
func addAgentTags(spans []*model.Span, agentTags []model.KeyValue) []*model.Span { | ||
for _, span := range spans { | ||
for _, tag := range agentTags{ | ||
span.Tags = append(span.Tags, tag) |
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.
It might depend. For example in k8s we support deploying agent as a side-car but also as daemon set (1 agent per k8s node).
I think we would need an additional flag to be able to add it to process tags
Thanks for the reviews. Addressed comments. Just the top level question remains. |
3cd2caf
to
82ba1d3
Compare
Codecov Report
@@ Coverage Diff @@
## master #1396 +/- ##
========================================
Coverage ? 100%
========================================
Files ? 165
Lines ? 7538
Branches ? 0
========================================
Hits ? 7538
Misses ? 0
Partials ? 0
Continue to review full report at Codecov.
|
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.
The change is not particularly complex, I think the coverage can be kept at 100.
We may want to consider excluding changes to TChannel reporter dealing with jaeger.thrift/zipkin.thrift, because we're planning to deprecate & remove TChannel reporter in the near future, so this will reduce the amount of tests needed to keep the coverage. But ok to keep too.
Signed-off-by: Annanay <annanay.a@media.net>
Signed-off-by: Annanay <annanay.a@media.net>
Signed-off-by: Annanay <annanay.a@media.net>
Signed-off-by: Annanay <annanay.a@media.net>
Signed-off-by: Annanay <annanay.a@media.net> nit, fix function call Signed-off-by: Annanay <annanay.a@media.net> nit, fix function call Signed-off-by: Annanay <annanay.a@media.net> fix fmt, gosimple Signed-off-by: Annanay <annanay.a@media.net> make fmt
Signed-off-by: Annanay <annanay.a@media.net> Fix tag names Signed-off-by: Annanay <annanay.a@media.net>
Signed-off-by: Annanay <annanay.a@media.net>
Signed-off-by: Annanay <annanay.a@media.net>
Signed-off-by: Annanay <annanay.a@media.net>
Signed-off-by: Annanay <annanay.a@media.net>
Thanks for the review @yurishkuro! I've added tests only for the grpc reporter for now, but do let me know if TChannel reporter tests are also required. |
If we're not adding tchannel tests, we shouldn't change tchannel code either, otherwise coverage will go down (which I can't see now because the bloody crossdock test failed again). |
Codecov is at 73%, let me remove all changes to tchannel reporter. |
Signed-off-by: Annanay <annanay.a@media.net>
Crossdock again 😅 |
Signed-off-by: Annanay <annanay.a@media.net>
Signed-off-by: Annanay <annanay.a@media.net>
Signed-off-by: Annanay <annanay.a@media.net>
Signed-off-by: Annanay <annanay.a@media.net>
Signed-off-by: Annanay <annanay.a@media.net>
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.
🎉
Thanks! :) |
Signed-off-by: Annanay annanay.a@media.net
Which problem is this PR solving?
Short description of the changes
--jaeger.tags
flag to enable tag addition (Ex:--jaeger.tags=key=value
). This can be used with env variables.