-
Notifications
You must be signed in to change notification settings - Fork 780
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 static tags to specific meter and/or instruments #4316
Comments
Meter can have attributes (not yet added in .NET) - https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#get-a-meter Will this help you achieve the goal? |
Attributes at meter level should work for our scenario, and whatever the mechanism is should be efficient. Will this be added to .NET or OpenTelemetry? Do you have any timelines for when this will be available? The support for multiple namespace via additional dimension is being added by the MDM team and it won't be really complete without this feature :( |
Will this be added to .NET or OpenTelemetry? .NET. (The Meter ctor should be modified to optionally accept this). I don't think was requested to the .NET team, so no timeline. If you are looking for this to arrive this year, then we can ask .NET team for this right now, and see if they can accommodate this for .NET 8 |
I requested this from .NET first and Noah said that OTel probably already has this feature or might be the right place to have it so circling back here. |
If the ask is "Support for attributes in Meter" (https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#get-a-meter), then this should be in .NET. (Just like schema_url). This is same for Traces too. We can create issues in runtime repo for tracking right away. (it was not a top priority, as there were no asks for this and this is pretty new in spec too) If the ask is something else, but the above is just a mechanism to achieve your goal, yes, we need to discuss more offline and post back updates here. |
Can opening issues in runtime repo be prioritized, please? I'm surprised that static dimensions is something that is not asked often. I see that some exporters implement this feature (e.g., Geneva), but this is bizarre to me. The static dimension is a property of data emitted by the telemetry system, not the exporter - one should be able to swap out exporters and keep the same set of static dimensions attached to the meter, log, or a trace. |
Frankly, the fact that static dimensions support has dependency on .NET runtime doing something is mind boggling to me. |
This is not about static dimensions overall - those should be modelled as Resources, which is supported aready. |
The entire API (for tracing and metrics) is part of System.Diagnostics.DiagnosticSource package from github.com/dotnet/runtime. This repo only has the OTel SDKs. So anything changes to the API (eg: Meter, Counter etc), should come from runtime repo! |
Do you mind pointing me to the right sample/doc for that, please? |
@cijothomas I was attempting to add attributes to the Resource using the .NET provider (i.e. adding the Azure Region, Stamp, dnsdomain) where the app is running in Azure) and using the AzureMonitorMetricExporter to forward to AppInsights... I see the values showing up when I use the AzureMonitorTraceExporter and use the Console Exporter, but the Metrics in the Console don't show the dimensions coming out, and I don't see them in AppInsights.
My question with your statement above "This is not about static dimensions overall - those should be modelled as Resources, which is supported aready", if this means that the resources should be static at creation time (they are), or does this mean that only the "service_name" is currently supported? |
@joebeernink If resources are showing up in Console Exporter for Metrics, but not showing up in Application Insights, this indicates an issue with Application Insights, and should be reported to Application Insights repo/team. |
Yes to "resource should be known at creation time. It cannot be modified after provider is built". |
They're showing up in the Console for Traces, but not for Metrics as far as I can tell. We're attempting to use the AspNetCoreInstrumentation capabilities and haven't tried this with custom traces / metrics [14:08:50 INF] Request finished HTTP/1.1 GET https://localhost:7186/api/permission/ - - - 401 - application/json;+charset=utf-8 1340.4469ms Export http.client.duration, Measures the duration of outbound HTTP requests., Unit: ms, Meter: OpenTelemetry.Instrumentation.Http/1.0.0.0 Export http.server.duration, Measures the duration of inbound HTTP requests., Unit: ms, Meter: OpenTelemetry.Instrumentation.AspNetCore/1.0.0.0 |
Please create a new issue with a minimal repro app. Use the example from here, and add the change required to show Resource is not working :https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/docs/metrics/getting-started/Program.cs |
Figured it out... the values appear when the first metric is logged when the app starts, but don't repeat each time the metric reports to the console, which makes sense since they are static at app startup. Resource associated with Metric: |
Created an ask on dotnet runtime for this |
I suspect I must have misunderstood something. I agree with @cijothomas that allowing .NET developers to specify default static metrics at a Meter or Instrument scope is an API I'd expect to land in the runtime on the Meter/Instrument objects. Sorry I didn't mean to lead you in a circle. I'm guessing there would also be some work in OTel to retrieve the tags from the Meter or Instrument object and pass them along to exporters.
Not that I am pushing back on adding Meter/Instrument APIs for tags at all, but what happens if the 3rd party library creates a Meter and your code never has access to it? If that is a possibility then it might still be the case that the exporter, a processor, or something else in the OTel API would facilitate adding tags to measurements produced from inaccessible Meters/Instruments. |
What is the issue number on dotnet runtime? |
I created a repo with a small ASP.NET Core site to test with open telemetry. It's very basic, but illustrates what we are trying to do. https://github.com/joebeernink/DemoOpenTelemetry. Would love to work with you to try out any ideas you might have. I was at Microsoft up until a month ago working in Azure, so I've got a pretty good knowledge of how devs will want to use this stuff. |
|
Following up on this issue. I upgraded to the 1.5.0 Beta of OpenTelemetry.Instrumentation.Http but I'm still not seeing custom dimensions come through to Application Insights for Metrics. This is really important to help split calls up by application, region, or customer to do analysis of outbound response issues. Any ideas how to fix this? services.AddOpenTelemetry()
|
@joebeernink |
This issue looks done. The support for ActivitySource is tracked by #3636 and dotnet/runtime#93795. Is there any reason to keep this issue open? |
OTel still has some work to do to make this available in OTel. |
Tagging for upcoming milestone (1.7.0). DS changes are ready, but OTel Metric class/elsewhere needs some changes as well. |
I thought the remaining work is tracked by #4563. anyway, I was just trying to point if there is any action needed on this issue. |
Sorry my bad! You are right! |
#4563 duplicate |
Feature Request
Is your feature request related to a problem?
Yes
If so, provide a concise description of the problem.
Currently, the metric agents/extension that we use is working on adding a feature to direct different metrics to different namespaces. The way this feature is being added is by means of a tag i.e. if a user wants to direct a specific metric to a non-default namespace then the instrument needs to add an additional dimension that carries the namespace to override the default.
It's not feasible for the specific instrument add/record calls to add the specific dimensions as becomes too messy to use. E.g. consider the scenario of third party library that emits metrics. As a service owner I use 10s of 3rd party libraries that emit metrics and I want to emit metrics from different libraries to different namespaces. Not all 3rd party libraries can't be modified to support the same feature so I need an ability to add some static properties for all metrics emitted by meter objects or specific instruments.
Currently .NET instrument APIs don't provide any such mechanism and OpenTelemetry metrics implementation also doesn't provide any such mechanism either.
Describe the solution you'd like:
I should be able to configure some static tags to be included for specific instruments and/or all instruments emitted from a specific meter instance, possibly at the startup configuration time.
What do you want to happen instead? What is the expected behavior?
Describe alternatives you've considered.
There are no straightforward alternatives today when using .NET Meter APIs and OpenTelemetry. The only alternative is to wrap .NET Meter APIs behind custom meter/instrument APIs, so metrics can be customized before they are fed into .NET meter
Additional Context
Add any other context about the feature request here.
The text was updated successfully, but these errors were encountered: