DataDog / dd-trace-dotnet

.NET Client Library for Datadog APM

Home Page:https://docs.datadoghq.com/tracing/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add the ability to provide a prefix for metrics and provide global metric tags

thomasf7 opened this issue · comments

Is your feature request related to a problem? Please describe.

I am trying to enable dotnet runtime metrics for my service using Datadog.Trace, but running into a limitation where unlike the pattern with other metrics we emit this library does not appear to provide any way to provide a metric name prefix. This is supported in the statsd client, and is set internally in the call via CreateDogStatsdClient, but this is not exposed as an option in the TracerSettings so is always set to null. While we can use tags, including the serviceName tag set via TracerSettings, to filter the metrics, this is not our preferred approach to differentiate metrics coming from different services.

In addition to this, there are a number of constantTags that are set on all the metrics emitted for the runtime stats, but this is a fixed set and there is no way to provide additional tags beyond this.

Describe the solution you'd like

  • Add an option to provide a metrics prefix when configuring the tracer, which defaults to null.
  • Add an option to provide a set of metric tags when configuration the tracer to include in the existing constantTags

Describe alternatives you've considered
N/A

Additional context
N/A

Hi @thomasf7 sorry for the delay, this one slipped through the cracks!

To address your proposals

Add an option to provide a metrics prefix when configuring the tracer

Unfortunately this isn't possible for technical reasons in the backend. For one, it would break the various dashboards and existing integrations we have.

Add an option to provide a set of metric tags when configuration the tracer to include in the existing constantTags

This seems reasonable. We were considering including the values set in DD_TAGS (which are automatically added to all spans) to be added to the runtime metrics too. Would that make sense to you? Or would you potentially want to add different tags to the runtime metrics specifically?

Thanks, and sorry again for the delay

This seems reasonable. We were considering including the values set in DD_TAGS (which are automatically added to all spans) to be added to the runtime metrics too. Would that make sense to you? Or would you potentially want to add different tags to the runtime metrics specifically?

It has been a while since I looked at this, but I think including the same tags in the runtime metrics too makes sense and will work for our use case.

#4580 added attaching of DD_TAGS to the runtime metrics (and resolved some other issues). It should be included in the next release. Hope that helps! 🙂