-
Notifications
You must be signed in to change notification settings - Fork 357
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 in dotnet-monitor's collector #3587
Conversation
…3529) * Got basic counter rate end-to-end working - currently in a broken state as I investigate other types of metrics * Leftovers from previous commit * Gauges working for systems diagnostics metrics * Added in histogram, adding in options for maxHistograms and maxTimeSeries * Added in error payloads for logging purposes * Temporarily changed visibility for testing - this may be reverted later * Now handling multiple sessions * Added filtering for counters, instead of allowing all counters for a provider to go through. * Handle observable... errors * Some cleanup, added error event check * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20221129.1 (#3528) [main] Update dependencies from dotnet/source-build-reference-packages Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Merge main to feature branch
* Fix ICountersLogger contract * MetadataUpdates * Fixup api protection levels * Fixup tests and add CounterEnded payload * Fixup metadata parsing
Merge main to feature/eventPipeMeters
merge main to feature/eventPipeMeters
Minor branch cleanup
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.
This seems fine so far to me!
src/Microsoft.Diagnostics.Monitoring.EventPipe/Counters/TraceEventExtensions.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Diagnostics.Monitoring.EventPipe/Counters/EventCounterPipeline.cs
Show resolved
Hide resolved
Sweet this is one of the big gaps with the new Metrics API that I wanted to get addressed and I was going to come talk to you all about it. I'm very happy to see you beat me to it! |
src/Microsoft.Diagnostics.Monitoring.EventPipe/Counters/TraceEventExtensions.cs
Show resolved
Hide resolved
src/Microsoft.Diagnostics.Monitoring.EventPipe/Counters/TraceEventExtensions.cs
Outdated
Show resolved
Hide resolved
PR for feature branch
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/MetricSourceConfiguration.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/MetricSourceConfiguration.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Diagnostics.Monitoring.EventPipe/Counters/TraceEventExtensions.cs
Outdated
Show resolved
Hide resolved
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.
LGTM modulo a few inline comments
src/Microsoft.Diagnostics.Monitoring.EventPipe/Counters/CounterPayload.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Diagnostics.Monitoring.EventPipe/Counters/TraceEventExtensions.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Diagnostics.Monitoring.EventPipe/Counters/TraceEventExtensions.cs
Outdated
Show resolved
Hide resolved
Convert Histogram to single payload
Merge main to eventPipeMeters
Fix issue with empty quantiles
|
||
if (commaIndex < 0) | ||
if (string.IsNullOrEmpty(quantilesText)) |
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.
@noahfalk after histogram values are no longer reported regularly in the app, the quantiles here become empty. is this by design?
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.
Yep, the app hasn't disposed the Histogram and also hasn't recorded any data within the measurement interval then by design you get an event where the quantiles string is empty. There is a test case for that behavior here: https://github.com/dotnet/runtime/blob/main/src/libraries/System.Diagnostics.DiagnosticSource/tests/MetricEventSourceTests.cs#L374
When doing the design initially I thought that sending an explicit event with empty content would let tools know with confidence that the app didn't produce data whereas if an event is absent it is ambiguous what the app did.
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.
Should this then return a CounterEndedPayload
instance?
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'll double check this behavior, but I believe it produces more data if more data occurs. I will change our pipeline to produce the event with no quantiles, and we can simply discard them during consumption.
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, the MetricEventSource events should behave the way you are describing Wiktor. You could choose to model it different ways when you are processing it but looking at Prometheus probably provides a good point of comparison. You could make a Prometheus.NET histogram, record no data, and see what shows up on the metrics endpoint.
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/MetricSourceConfiguration.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/MetricSourceConfiguration.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/MetricSourceConfiguration.cs
Outdated
Show resolved
Hide resolved
} | ||
|
||
// Copied from dotnet-counters | ||
public CounterPayload(string providerName, string name, string displayName, string displayUnits, string metadata, double value, DateTime timestamp, string type, EventType eventType) |
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.
displayName
is not used; either remove it, or (preferably) have it set the DisplayName property, change the property to get-only, and call all upstreams to pass in the coerced display name value.
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.
There is a separate change for cleaning up all these constructors.
src/Microsoft.Diagnostics.Monitoring.EventPipe/Counters/CounterPipelineSettings.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Diagnostics.Monitoring.EventPipe/Counters/TraceEventExtensions.cs
Outdated
Show resolved
Hide resolved
|
||
if (commaIndex < 0) | ||
if (string.IsNullOrEmpty(quantilesText)) |
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.
Should this then return a CounterEndedPayload
instance?
@kkeirstead completed most of code here.
Note: Currently the code duplicates the data model from the original dotnet-counters work.
Note there is additional work that is built on top of this feature branch