NServiceBus icon indicating copy to clipboard operation
NServiceBus copied to clipboard

Add processing times to OpenTelemetry metrics

Open timbussmann opened this issue 2 years ago • 4 comments

Describe the suggested improvement

The NServiceBus OpenTelemetry integration currently promotes the following metrics:

  • nservicebus.messaging.successes: Total number of messages processed successfully by the endpoint
  • nservicebus.messaging.fetches: Total number of messages fetched from the queue by the endpoint
  • nservicebus.messaging.failures: Total number of messages processed unsuccessfully by the endpoint

The NServiceBus.Metrics package supports more metrics though, for example

These metrics are currently not available when using the OpenTelemetry integration instead of the Metrics package. When using OpenTelemetry, it does only add noise and overhead to also rely on the NServiceBus.Metrics package for these additional metrics.

Describe the suggested solution

Add additional metrics to the built-in OpenTelemetry metrics, e.g. Critical time and processing time.

Additional Context

No response

timbussmann avatar Sep 26 '23 08:09 timbussmann

Does the NServiceBus.Metrics package expose the metrics via OpenTelemetry by default, or does it require custom code?

cjoergensen avatar Dec 06 '23 09:12 cjoergensen

@cjoergensen, the Metrics package was designed before the advent of OTel. It requires custom code to capture and report those metrics to an OpenTelemetry collector. I'm not sure the data exposed by the Metrics package have all the needed information to plugin into the OTel activities model.

More details in our documentation.

mauroservienti avatar Dec 07 '23 15:12 mauroservienti

FYI, stay tuned! Great things are on the way according to David Boike!

https://github.com/Particular/docs.particular.net/issues/6446#issuecomment-1934468629

bbrandt avatar Feb 10 '24 00:02 bbrandt

Workaround to get these metrics in App Insights without the need for NServiceBus.Metrics: https://docs.particular.net/samples/open-telemetry/application-insights/

And Prometheus: https://docs.particular.net/samples/open-telemetry/prometheus-grafana/

bbrandt avatar Apr 25 '24 15:04 bbrandt

The missing metrics have been implemented in https://github.com/Particular/NServiceBus/pull/7097 and https://github.com/Particular/NServiceBus/pull/7095. They will be released soon as part of 9.1

SzymonPobiega avatar Jul 19 '24 08:07 SzymonPobiega