opentelemetry.io icon indicating copy to clipboard operation
opentelemetry.io copied to clipboard

Advice to provide attributes at span creation time

Open cijothomas opened this issue 1 year ago • 2 comments

What needs to be changed? Tracing docs for all language should advice to provide attributes at span creation time, as opposed to providing it later, wherever feasible. https://github.com/open-telemetry/opentelemetry.io/pull/3927#discussion_r1475378395

What is the name + path of the page that needs changed? All.

cijothomas avatar Feb 05 '24 19:02 cijothomas

Workshopping the text:

Attributes let you attach key/value pairs to a span so it carries more information about the current operation that it’s tracking.

There are two ways you can add attributes to a span - during creation, or after creation.

Generally speaking, you should try to add all attributes that you can during creation. This is so that you can use these attribute values to guide SDK sampling decisions, which are made only during span creation. If you can't feasibly add an attribute until after span creation, then that attribute cannot be used to influence an SDKsampling decision.

@cijothomas how do you feel about this wording? Note that I mentioned SDK sampling decision, since post-creation attributes can absolutely be used for tail-based sampling decisions.

cartermp avatar Feb 05 '24 20:02 cartermp

Yes, it makes sense to call out that we are talking the Sampling in tracing SDK, not tail-based. Thanks!

cijothomas avatar Feb 05 '24 21:02 cijothomas