-
Notifications
You must be signed in to change notification settings - Fork 844
Aligning metrics with OTel semantic conventions #4482
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
Changes from 6 commits
151488a
0e76509
eb3189c
3ca7aa2
bd7a57c
7cab4c8
98e3f0e
2967ec9
2fc604f
fa01223
3a66a5d
fa88043
3613c4d
717678c
bca9575
1887075
d036ccc
43a73fe
e10ccda
a8af544
fc8c3e0
fac0bb4
ddd86c0
dde8e31
c61c8d3
0d244ba
42ac60e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,10 +12,12 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks; | |
|
|
||
| internal static partial class Metric | ||
| { | ||
| [Counter("healthy", "status", Name = @"R9\\HealthCheck\\Report")] | ||
| // TODO: should we rename "healthy" to "is_healthy"? Or maybe remove the attribute at all? | ||
| // To klauco: do we really need this true/false dimension? We already have "health.status" dimension. | ||
| [Counter("healthy", "health.status", Name = "health_check.reports")] | ||
xakep139 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| public static partial HealthCheckReportCounter CreateHealthCheckReportCounter(Meter meter); | ||
|
|
||
| [Counter("name", "status", Name = @"R9\\HealthCheck\\UnhealthyHealthCheck")] | ||
| [Counter("health_check.name", "health.status", Name = "health_check.unhealthy_checks")] | ||
|
||
| public static partial UnhealthyHealthCheckCounter CreateUnhealthyHealthCheckCounter(Meter meter); | ||
|
|
||
| public static void RecordMetric(this HealthCheckReportCounter counterMetric, bool isHealthy, HealthStatus status) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,24 +7,24 @@ namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring; | |
| /// Represents the names of instruments published by this package. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// These counters are currently only published on Linux. | ||
| /// These metrics are currently only published on Linux. | ||
| /// </remarks> | ||
| /// <seealso cref="System.Diagnostics.Metrics.Instrument"/> | ||
| public static class ResourceUtilizationCounters | ||
xakep139 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| /// <summary> | ||
| /// Gets the CPU consumption of the running application in percentages. | ||
| /// Gets the CPU consumption of the running application in range <c>[0, 1]</c>. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a stepping back question regarding all utilizations measured by %. Related discussions and PRs:
FYI @noahfalk IIRC for garbage collector metrics we decided to use absolute value (e.g. total time spent in GC since the beginning of the process lifecycle), and encourage users to derive utilization based on their actual need (so the user can choose whatever sliding window and sampling frequency).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I recall this component has a sampling mechanism and sliding window built into it and the app developer can configure some of those parameters or accept defaults. So when this component reports an instantaneous utilization measurement of 73%, it really means that over the last X minutes some aggregation of Y CPU usage samples had an average CPU utilization of 73% for the app developer's chosen X and Y. Its not the pattern I'd expect most metrics to follow as there is extra implementation complexity and it can't accurately be re-aggregated to compute other sliding windows later. However because the app developer configures a sampling window of known fixed size it doesn't suffer from the issues that those other metrics had where they inferred a sample window from the polling frequency or from some unpredictable process behavior. A while back I encouraged the engineers who were working on this to simplify and not maintain their own sliding window sampling reservoir, but I feel like what is there now is still well defined and likely useful as long as the sampling window is configured well up-front. I didn't object to this even though I expect metrics of this style will be an outlier in the long run. Having something like this shouldn't block us from later creating an alternate metric that emits absolute measures of CPU and memory usage with more aggregation flexibility. @reyang do you feel like that addresses your concerns or you are still worried here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not too concerned about having alternative metrics that customers can conveniently use - as long as there is clarity:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@noahfalk given OpenTelemetry.Instrumentation.Process is still in Preview, I think we should make a decision about the direction - e.g. all CPU/Memory metrics will be exposed by @Yun-Ting FYI since you've worked on
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My thought would be: In the future (.NET 9?) - Implement the core CPU + memory metrics currently in OTel.Instrumentation.Process inside System.Diagnostic.DiagnosticSource. I think metrics like What does everyone think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Just confirming - point devs that are using any supported version of .NET (core/framework), not just limited to folks who use .NET 8?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I meant as of November 2023 (or whenever this assembly releases as stable), all .NET devs should be able to use ResourceMonitoring to satisfy their need for CPU/Virtual Memory metrics. NOTE: After I wrote that I saw that this library has a weirdly inconsistent approach to how it measures memory. I'm presuming that gets resolved. If it didn't then I wouldn't feel comfortable recommending it. |
||
| /// </summary> | ||
| /// <remarks> | ||
| /// The type of an instrument is <see cref="System.Diagnostics.Metrics.ObservableGauge{T}"/>. | ||
| /// </remarks> | ||
| public static string CpuConsumptionPercentage => "cpu_consumption_percentage"; | ||
| public static string CpuUtilization => "process.cpu.utilization"; | ||
xakep139 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// <summary> | ||
| /// Gets the memory consumption of the running application in percentages. | ||
| /// Gets the memory consumption of the running application in range <c>[0, 1]</c>. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// The type of an instrument is <see cref="System.Diagnostics.Metrics.ObservableGauge{T}"/>. | ||
| /// </remarks> | ||
| public static string MemoryConsumptionPercentage => "memory_consumption_percentage"; | ||
| public static string MemoryUtilization => "process.memory.utilization"; | ||
xakep139 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.