-
Notifications
You must be signed in to change notification settings - Fork 441
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
base: main
Are you sure you want to change the base?
Conversation
statsd.Gauge(MaxOpenConnections, float64(stat.MaxOpenConnections), tags, 1) | ||
statsd.Gauge(OpenConnections, float64(stat.OpenConnections), tags, 1) | ||
statsd.Gauge(InUse, float64(stat.InUse), tags, 1) | ||
statsd.Gauge(Idle, float64(stat.Idle), tags, 1) | ||
statsd.Gauge(WaitCount, float64(stat.WaitCount), tags, 1) | ||
statsd.Timing(WaitDuration, stat.WaitDuration, tags, 1) | ||
statsd.Gauge(MaxIdleClosed, float64(stat.MaxIdleClosed), tags, 1) | ||
statsd.Gauge(MaxIdleTimeClosed, float64(stat.MaxIdleTimeClosed), tags, 1) | ||
statsd.Gauge(MaxLifetimeClosed, float64(stat.MaxLifetimeClosed), tags, 1) |
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
or OTEL_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 by newConfig
, and retrieved when setting up the DB statsd client.
We'll update the public documentation to make sure it reflects this detail.
Hi @KaibutsuX , As @darccio pointed out, tags set in Are you trying to pass your global tags down to DBStats metrics, or are you looking to apply a unique set of tags specifically to those metrics? If the former, Thank you! |
@mtoffl01 I will see if using DD_TAGS works as expected. You may want to also update the documentation for DD_TAGS as it is marked as an array, but in go code it accepts a |
Hi @KaibutsuX , Thanks for the tip! We will change the |
What does this PR do?
Motivation
Reviewer's Checklist
v2-dev
branch and reviewed by @DataDog/apm-go.Unsure? Have a question? Request a review!