opentelemetry-dotnet icon indicating copy to clipboard operation
opentelemetry-dotnet copied to clipboard

Support dropping of specific attributes from instrument

Open dpk83 opened this issue 2 years ago • 6 comments

Feature Request

Is your feature request related to a problem?

We need the ability to drop specific attributes from reported metrics.

Taking the example from the View spec.

For example, an HTTP server library might expose HTTP verb (e.g. GET, POST) and HTTP status code (e.g. 200, 301, 404). The application developer might only care about HTTP status code (e.g. reporting the total count of HTTP requests for each HTTP status code).

The SDK currently provides an option to specify a set of keys which are the only ones to be included, however in our scenario we support dynamic enrichment of metrics so some of the attributes are not known at the time of creation of the instrument. So to drop the specific instruments we need the ability to specify the list of attributes which needs to be dropped and rest all needs to be included in reported metrics.

Currently support only provide the option to include certain attributes while dropping rest of the attributes which doesn't cover the above scenario and is not sufficient.

Describe the solution you'd like:

Need ability to specify a set of attributes (as part of the View) which needs to be dropped from the metric (if exists).

Describe alternatives you've considered.

The only alternative is to capture the emitted metric and create a completely new metric which drops the desired attributes while dropping the original metric completely. This is unacceptable alternative though.

Additional Context

dpk83 avatar Apr 24 '23 22:04 dpk83

@noahfalk This is one missing piece of support that will be needed from either OpenTelemetry SDK or directly from .NET Meter API to be able to consume .NET metrics that James plugged in. I assumed this should be coming from OpenTelemetry SDK based on the other similar features like renaming metric, including only specific attributes etc.

FYI @reyang

dpk83 avatar Apr 24 '23 22:04 dpk83

What's missing? https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/metrics/customizing-the-sdk#select-specific-tags

reyang avatar Apr 24 '23 22:04 reyang

If there is additional feature needed which is not captured by the SDK spec, file issue in the spec repo.

reyang avatar Apr 24 '23 22:04 reyang

@reyang Created an issue on spec as well https://github.com/open-telemetry/opentelemetry-specification/issues/3441

dpk83 avatar Apr 25 '23 18:04 dpk83

This issue was marked stale due to lack of activity and will be closed in 7 days. Commenting will instruct the bot to automatically remove the label. This bot runs once per day.

github-actions[bot] avatar Oct 08 '24 03:10 github-actions[bot]

Spec allows this now, https://github.com/open-telemetry/opentelemetry-specification/pull/4188 So this issue must be un-stale

cijothomas avatar Oct 08 '24 05:10 cijothomas