micrometer-metrics / tracing

Provides tracing abstractions over tracers and tracing system reporters.
https://micrometer.io
Apache License 2.0
234 stars 38 forks source link

Missing required attributes on OpenTelemetry Spans #294

Closed arik-dig closed 1 year ago

arik-dig commented 1 year ago

looking at the OTEL semantic conventions of Telemetry SDK it seems that 3 entries are required: telemetry.sdk.name , telemetry.sdk.language , telemetry.sdk.version

Actual Result

however when using it with Spring-Boot (petclinic application) I could not see those

image

trace_abcd1234_json.txt

Expected result

When using the standard OTEL java agent so seeing those entries:

Attribute Value
telemetry.sdk.language java
telemetry.sdk.name opentelemetry
telemetry.sdk.version 1.26.0
marcingrzejszczak commented 1 year ago

Thank you for filing the issue.

Micrometer Tracing just offers a bridge over OpenTelemetry. You can file in issue in Framework but I doubt that they will do anything about it because Spring never said that it will be OpenTelemetry Semantic Convention compatible. Mainly for the reason that the conventions are in alpha-state and introduce breaking changes. Also Spring projects have a different approach related to upgrading dependencies. Nobody will release a new minor version every month as OTel does. Unless you're talking about some missing global attribute configuration that is missing?

Another question which version of Semantic Conventions are you referring to? When did those attributes became a mandatory requirement?

bclozel commented 1 year ago

@arik-dig I'm confused. How is the Petclinic application instrumented in the first place? Is it the built-in Spring instrumentation involved here? Or is the OTel Java agent involved? In the second case you're referring to telemetry.sdk.* tags. What would be the expected values here? Something like:

Attribute Value
telemetry.sdk.language java
telemetry.sdk.name micrometer
telemetry.sdk.version 1.12.0

Technically, Micrometer doesn't instrument the libraries, it's just providing an API for that. While it makes sense for an agent, this metadata will not say much about the instrumentation itself.

arik-dig commented 1 year ago

since you're bridging to OTEL so the value of telemetry.sdk.name MUST be opentelemetry. look at the doc: OTEL semantic conventions of Telemetry SDK.

(snippet from it) image

It seems like you should work with class io.opentelemetry.sdk.resources.Resource and merge your resources with the getDefault() one. see https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk/common/src/main/java/io/opentelemetry/sdk/resources/Resource.java#L69

Regarding micrometer itself I guess it good idea to add some tag to indicate its micrometers one + the version, but its out of scope for this one - that relevant to OpenTelemetry.

jonatan-ivanov commented 1 year ago

I opened a PR for this in Boot: https://github.com/spring-projects/spring-boot/pull/36155