-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add support for System.Diagnostics.Metrics #329
Comments
Any idea when dotnet-monitor will support the new metrics APIs? |
More then one year and nothing? |
I am glad to see this issue has not been closed, so there is hope it will be completed. However, in the meantime, does anyone have a workaround? Our project is being deployed in Kubernetes. In our environment, I have to use Prometheus scrape. Right now, this is working great for the dotnet-monitor metrics. However, I am missing a lot of other metrics exposed by our application or 3rd party libraries. I could use another sidecar that does metric aggregation. I have heard that the .NET API Gateway Ocelot can aggregate responses. I was thinking it would be possible expose a Does anyone have an example of exporting both dotnet-monitor metrics and System.Diagnostics.Metrics for Prometheus scrape? The metrics aggregator can use any technology. Preferred approach would not require me building a custom container. A stable container with configuration file / environment variables will minimize deployment effort. Edit: added above comment to new discussion #2798. |
@pbolduc I ended up using dotnet-monitor side container to export event counters and OpenTelemetry within the application itself to export everything else. Yes it's two scraping endpoints per single application instance and ideally I would love to have it all outside the application itself, but I couldn't find any better way to do it. |
Because I have to use Prometheus scrape and need to annotate the Edit: perhaps this should be moved to discussions instead of this issue. |
Another option is to ditch the dotnet-monitor sidecar and just use the OpenTelemetry to export both your 'system' metrics and application metrics....you just need to add a few additional nuget packages and wire them us like this....
|
Thank you. I am going to take this approach. I have referenced this answer in discussion #2798. |
Just wanted to give an update to everyone following this issue - we've started actively working on adding support for |
@kkeirstead thanks for info |
@kkeirstead any news? |
Sure! We've just finished adding initial limited support for |
Quick update - 8.0 Preview 1 was released earlier this week with our initial limited support for |
Running a .NET 7.0 app and added Metrics from System.Diagnostic.Metrics assuming dotnet-monitor would support it, but I cannot get dotnet-monitor to report them via /metrics endpoint. Also unsure what the naming convention for what Metrics should be for injestion via dotnet-monitor, I am running Running Specifying the metrics in the settings.config does not help either:
Any assistance would be appreciated, burnt a lot of time thinking that |
I could be wrong, but the .NET Monitor docs might be missing/outdated for the System.Diagnostics.Metrics specification. Meters are specified separately (using the |
+1 to Justin's comment - we made a change to our initial schema after writing up the docs, and it looks like updating them slipped through the cracks (I believe this is the relevant PR). I've created a new issue to track this to prevent any further confusion around the docs (see here) - thanks for bringing this to our attention! I've rewritten out your configuration using the new schema - feel free to give this a try and let me know if you have any issues so that we can get you up and running.
One additional note - I don't know how you've named your instrument in the target app, but I tend to do "my-counter", which is then how I would include it in the |
Perfect thank you guys! I hated having to add the OpenTelemetry assemblies to my app when I have a dotnet-monitor sidecar already for dumps clr metrics. Using |
System.Diagnostics.Metrics support has been available since .NET Monitor 8. Please see the following documentation for how to enable collection: https://github.com/dotnet/dotnet-monitor/blob/main/documentation/configuration/metrics-configuration.md#adding-metersinstruments-for-systemdiagnosticsmetrics |
Background and Motivation
dotnet-monitor currently only supports collection of EventCounter metrics. Given that the dotnet team's recommendation is to use System.Diagnostics.Metrics for new metrics, we should expose via the
/metrics
endpoint as wellProposed Feature
There currently isn't an out-of-process consumption mechanism for
System.Diagnostics.Metrics
and whatever we do will be dependent on a new runtime feature. It will probably be something similar toDiagnosticsSourceEventSource
The text was updated successfully, but these errors were encountered: