Add code.* semantic attributes details to spec#319
Conversation
| [[sec:code-conventions]] | ||
| ==== Code Attributes | ||
|
|
||
| The https://github.com/open-telemetry/semantic-conventions/blob/v1.40.0/docs/registry/attributes/code.md[Semantic Conventions for code attributes] provide context about source code. |
There was a problem hiding this comment.
The version number should use the variable defined in the spec
| Span context MUST also contain the mandatory code attribute `code.function.name` as outlined in the <<sec:code-attributes>> sec. | ||
|
|
There was a problem hiding this comment.
We probably need few more datapoints about the possible overhead and feasability.
For example for Payara (and OpenLiberty alike I believe) it is trivial to know the method name, because the annotation is implemented via an Interceptor. I don't find definitive whether these attributes are added by Java Agent or whether they can be configured in that scenario. It seems like they can't though.
Semantic conventions does not impose a particular Requirement Level for code.function.name, but in cases where this information would be possibly expensive to obtain the convention recommend Opt-In.
We don't have any opt-in configuration facility in the spec yet, we could consider configuration property such as mp.otel.with-span.code-attributes.enable to explicitly request runtime to fill in the attribute.
Also looking at open-telemetry/opentelemetry-java-instrumentation#7345, it looks that agent is adding code attributes for Jakarta Rest Resource methods, which is something that should also be considered, even without Opt-In.
For #107