GoogleCloudPlatform / opentelemetry-operations-java

Apache License 2.0
71 stars 41 forks source link

Add config to skip attaching InstrumentationScopeInfo as labels #357

Closed Noremac201 closed 1 month ago

Noremac201 commented 1 month ago

For some first-party Google Cloud metrics, there can be a need to export to publicy writable metrics directly. This can cause issues when attaching instrumentation scope info as labels, as this will be rejected by the createTimeSeries call if mismatched labels are found. There is currently no way to disable this on a config-based level, which means writing to 1P metrics is currently infeasible without a custom code change.

Example error:

WARNING: Exporter threw an Exception
com.google.api.gax.rpc.InvalidArgumentException: io.grpc.StatusRuntimeException:
 INVALID_ARGUMENT: One or more TimeSeries could not be written: Unrecognized metric 
labels: [instrumentation_source], [instrumentation_version]; 

This is a feature on some other exporters as well:

https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/648a71ca81a051f32a3accc68c62f60c75469822/exporter/collector/config.go#L127