open-telemetry / opentelemetry-dotnet-contrib

This repository contains set of components extending functionality of the OpenTelemetry .NET SDK. Instrumentation libraries, exporters, and other components can find their home here.
https://opentelemetry.io
Apache License 2.0
472 stars 281 forks source link

GenevaMetricExporter: Add ResourceBuilder support #835

Open dpk83 opened 1 year ago

dpk83 commented 1 year ago

Issue with OpenTelemetry.Exporter.Geneva

Is this a feature request or a bug?

What is the expected behavior?

GenevaMetricExporter should respect the resource builder and add attributes from resource to the emitted metrics.

What do you expect to see?

As a user when I set a resource builder the attributes detected from resources are added as dimensions(aka tags) to all metrics exported to Geneva.

What is the actual behavior? Currently resource builder is completely ignored by Geneva metric exporter.

Additional Context

Add any other context about the feature request here.

reyang commented 1 year ago

I haven't spent time thinking through this, my gut feeling is that there will be a combination of the following two features and I believe this issue is more about the 2nd one:

  1. In the OpenTelemetry SDK, the View API will allow the application/service developer to configure a particular metrics stream to use certain dimensions from Resource.
  2. In the Geneva Exporter, there is a mechanism which allows Resources (all or user specified) to be converted to dimensions.

I think 2 should be fairly easy as long as we decide the behavior. There is one design decision we'll have to make - will resources be used by default as dimensions or not? (e.g. I don't think it's good idea to take all Resources and convert them to dimensions by default).

cijothomas commented 1 year ago

1 -> The OTel SDK's View does not have the capability to use Resource as the dimension.

2 is reasonable, with opt-in behavior, and probably another flag to determine the conflict-resolution (does Resource override samenamed attribute that is provided during reporting of measurement.?

Bpoe commented 11 months ago

FYI - OTel uses a lot of attribute names with "." in them. The Geneva to Kusto pipeline doesn't handle these well. When you work on this, please take this into account.

cizra commented 6 months ago

It is also possible to attach attributes to Meters, and instruments like Histogram. These attributes also don't get picked up by Geneva metric exporter. Would adding support for these fit into this feature request, or should I file a new one?

cijothomas commented 6 months ago

It is also possible to attach attributes to Meters, and instruments like Histogram. These attributes also don't get picked up by Geneva metric exporter. Would adding support for these fit into this feature request, or should I file a new one?

The upcoming version of GenevaExporter will be using otlp proto format as its payload, so anything supported in OTLP would be automatically supported. That includes Resource and Meter attributes. (Note: Instrument level attributes is not really a spec thing, it exists in the API, but not supported in the OTel SDK itself. See https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/metrics#metrics-enrichment)

cizra commented 6 months ago

Very interesting, thanks @cijothomas . Does it imply that at some point, GenevaExporter could be deprecated and expect Geneva MA would accept OtlpExporter?

cijothomas commented 6 months ago

Very interesting, thanks @cijothomas . Does it imply that at some point, GenevaExporter could be deprecated and expect Geneva MA would accept OtlpExporter?

No. GenevaExporter is designed to export to operating system native systems (ETW in Windows, user_events in Linux soon), and that is required for high performance scenarios.

vishweshbankwar commented 5 months ago

It is also possible to attach attributes to Meters, and instruments like Histogram. These attributes also don't get picked up by Geneva metric exporter. Would adding support for these fit into this feature request, or should I file a new one?

The upcoming version of GenevaExporter will be using otlp proto format as its payload, so anything supported in OTLP would be automatically supported. That includes Resource and Meter attributes. (Note: Instrument level attributes is not really a spec thing, it exists in the API, but not supported in the OTel SDK itself. See https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/metrics#metrics-enrichment)

This is now available with https://www.nuget.org/packages/OpenTelemetry.Exporter.Geneva/1.8.0 as an experimental feature. See instructions to onboard.

DavidParks8 commented 4 months ago

@vishweshbankwar, when will the experimental feature be available for linux?

vishweshbankwar commented 4 months ago

@DavidParks8 - Aug/Sept is tentative timeframe.