-
Notifications
You must be signed in to change notification settings - Fork 647
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
Emit critical time metric #7058
Conversation
src/NServiceBus.Core/OpenTelemetry/Metrics/MetricsExtensions.cs
Outdated
Show resolved
Hide resolved
d1df89e
to
829b70e
Compare
ff57dd7
to
bd2cb97
Compare
src/NServiceBus.Core/OpenTelemetry/Metrics/CriticalTimeMetrics.cs
Outdated
Show resolved
Hide resolved
src/NServiceBus.Core/OpenTelemetry/Metrics/MetricsExtensions.cs
Outdated
Show resolved
Hide resolved
src/NServiceBus.Core/OpenTelemetry/Metrics/MetricsExtensions.cs
Outdated
Show resolved
Hide resolved
Reverting to draft to signal the dependency on #7077 and preventing accidental merge |
1b9dc91
to
53eb461
Compare
Use Dictionary i.o. IReadOnlyDictionary for performance.
…to prevent adding unwanted tags everywhere in the future.
aedfe04
to
8ebd3e1
Compare
@lailabougria @SzymonPobiega, this is ready for a review |
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.
again only nits
src/NServiceBus.AcceptanceTests/Core/OpenTelemetry/When_incoming_message_handled.cs
Show resolved
Hide resolved
@@ -19,4 +19,7 @@ class Meters | |||
|
|||
internal static readonly Histogram<double> MessageHandlerTime = | |||
NServiceBusMeter.CreateHistogram<double>(Metrics.MessageHandlerTime, "s", "The time in seconds for the execution of the business code."); | |||
|
|||
internal static readonly Histogram<double> CriticalTime = | |||
NServiceBusMeter.CreateHistogram<double>(Metrics.CriticalTime, "s", "The time in seconds between when the message was sent until processed by the endpoint."); |
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.
NServiceBusMeter.CreateHistogram<double>(Metrics.CriticalTime, "s", "The time in seconds between when the message was sent until processed by the endpoint."); | |
NServiceBusMeter.CreateHistogram<double>(Metrics.CriticalTime, "s", "The time in seconds from when the message was sent to when it was processed."); |
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'm fine either way. The documentation states the following:
The time between when a message is sent and when it is fully processed.
Shall we align the text here with docs?
NServiceBusMeter.CreateHistogram<double>(Metrics.CriticalTime, "s", "The time in seconds between when the message was sent until processed by the endpoint."); | |
NServiceBusMeter.CreateHistogram<double>(Metrics.CriticalTime, "s", "The time in seconds between when a message is sent and when it is fully processed."); |
incomingPipelineMetricTags.ApplyTags(ref tags, [ | ||
MeterTags.QueueName, | ||
MeterTags.EndpointDiscriminator, | ||
MeterTags.MessageType]); |
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.
@lailabougria @SzymonPobiega, is it useful to add here the MeterTags.MessageHandlerTypes
? It'll be published to both critical and processing time, reporting all the handlers involved.
incomingPipelineMetricTags.ApplyTags(ref tags, [ | |
MeterTags.QueueName, | |
MeterTags.EndpointDiscriminator, | |
MeterTags.MessageType]); | |
incomingPipelineMetricTags.ApplyTags(ref tags, [ | |
MeterTags.QueueName, | |
MeterTags.EndpointDiscriminator, | |
MeterTags.MessageType, | |
MeterTags.MessageHandlerTypes]); |
[Test] | ||
public async Task Should_not_record_critical_time_on_failure() | ||
{ | ||
using TestingMetricListener metricsListener = await WhenMessagesHandled(() => new MyExceptionalMessage()); | ||
metricsListener.AssertMetric(CriticalTimeMetricName, 0); | ||
} |
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.
@lailabougria, what do you think about this test? If that's what you meant, I'll add a similar one to the processing time metric PR
This PR introduces a new OpenTelemetry-native metric for measuring the message's critical time.
POA: