-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 for adding default tags to specific meter and/or instruments #84321
Comments
@dpk83 thanks for creating the issues. Some questions to know the expected behavior if we add this.
CC @reyang |
I'd propose if we do this we'd design for the tags to be immutable such as being specified as a constructor parameter. If the tags vary over time then it is probably preferable to either specify them as part of an individual measurement or create perhaps multiple Instrument/Meters with the same name that differ only by tags. We'd want to make sure OTel could appropriately handle the latter approach before recommending anyone do it.
I'd propose we don't modify the tags passed to the listener and treat the static tags as an Instrument/Meter property that consumers can read whenever they want. Its likely that OTel (or other consumers) want the union of the static and dynamic tags but the efficient way to merge them is to do that post-aggregation rather than pre-aggregation. Keeping the two sets distinct will allow consumers to do that more efficient merge and keeps the runtime API very simple. |
So, I would expect the following scenarios in this order of importance
Regarding pre vs post aggregation
I vote for post-aggregation |
Another requirement which I should probably create another issue is the ability to change the instrument name after instrument creation. |
Currently the instruments can access the Meter. Exposing a property on meter returning the attached tags should allow the instrument to access it.
I assume we will allow accessing these tags (like a property on the instrument), aggregators are free to use it the way it fits.
Why do you need to do that? Are you thinking of recycling the instruments? |
Here are a few scenarios
|
I think we should use the OpenTelemetry Metrics SDK View which will work with all instrumentations rather than having instrumentation libraries / instrumented libraries doing this individually. |
@reyang Right, using view is the way but you need the capability to change the metric name in the view which is what I am going for here. |
I'm confused, this is already working, no? |
That's using reflection in OpenTelemetry and that's not for changing the name of the metrics, it just let's you update the metric name validation regex. What we need is the ability to change the metric name itself. |
Have you looked at the link I posted above? |
My bad, I didn't look at the URL, I assumed you pointed to the OpenTelemetry's extensibility via Views. I should stop making any assumptions. Thanks for correcting me and yes we can utilize this capability in this case. |
My thoughts...
/cc @alanwest |
The current thought is to do that like what @noahfalk mentioned in the comment #84321 (comment) |
This is addressed by #86567 |
Currently there is no way to add default tag to a meter and/or instrument. There are scenarios where there are a set of common tags that needs to be applied to a group of metrics (which doesn't apply to all the metrics but a group of metrics). Currently there is no way to add these tags directly to the meter or instrument and the caller needs to pass these tags for every instrument when invoking Add/Record method every time. This limits us in 2 ways
I created an ask on the OpenTelemetry repo as well and it's clear that dotnet runtime is the right place for this feature, so creating one here. Please check the issue on OpenTelemetry repo for one of the actual scenario open-telemetry/opentelemetry-dotnet#4316
The text was updated successfully, but these errors were encountered: