-
Notifications
You must be signed in to change notification settings - Fork 445
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
Support sending custom tags when using pollDBStats #3067
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -31,6 +31,7 @@ type config struct { | |||||||||||||
tags map[string]interface{} | ||||||||||||||
dbmPropagationMode tracer.DBMPropagationMode | ||||||||||||||
dbStats bool | ||||||||||||||
statsTags []string | ||||||||||||||
statsdClient internal.StatsdClient | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
|
@@ -292,3 +293,10 @@ func WithDBStats() Option { | |||||||||||||
cfg.dbStats = true | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
func WithDBStatsTags(tags []string) Option { | ||||||||||||||
Comment on lines
+296
to
+297
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.
Suggested change
Could we make this a 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.
dd-trace-go/internal/statsd.go Line 16 in c345adb
That does make more sense, but since your public interfaces accept I'm closing this as I no longer have the time to spend on it. |
||||||||||||||
return func(cfg *config) { | ||||||||||||||
cfg.dbStats = true | ||||||||||||||
cfg.statsTags = 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.
@mtoffl01 Was there any reason behind not allowing tags from the beginning?
Checking the code, I see that for the purpose of this PR, it should be enough to set
DD_TAGS
orOTEL_PROPAGATORS
(if using OTel) to set these global tags.WDYT @KaibutsuX?
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 don't have enough context or documentation to know what
DD_TAGS
is or how I would set it as an end-user.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.
DD_TAGS
is properly explained in our Go tracer public documentation.We understand this should be enough to achieve what you are trying with this PR.
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.
That links says: "A list of default tags to be added to every span and profile." From my tracing through the code, I could not see that this same list of user-supplied tags was included in these metrics used in
pollDBStats
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.
Yes, we understand it may not that be clear from the code. Sorry about that. It inherits the global tags from the tracer config, set by
globalconfig.SetStatsTags
, which is initialized bynewConfig
, and retrieved when setting up the DB statsd client.We'll update the public documentation to make sure it reflects this detail.