1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-10-31 00:07:40 +02:00

Add disclaimer to span.SetAttributes (#7550)

From
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#span-creation

> The API documentation MUST state that adding attributes at span
creation is preferred to calling SetAttribute later, as samplers can
only consider information already present during span creation.

I couldn't find it, and we are marked as not including this in the spec
compliance matrix

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
This commit is contained in:
David Ashpole
2025-10-30 10:37:48 -04:00
committed by GitHub
parent 8b61c33710
commit c3eda343f6

View File

@@ -66,6 +66,10 @@ type Span interface {
// SetAttributes sets kv as attributes of the Span. If a key from kv
// already exists for an attribute of the Span it will be overwritten with
// the value contained in kv.
//
// Note that adding attributes at span creation using [WithAttributes] is preferred
// to calling SetAttribute later, as samplers can only consider information
// already present during span creation.
SetAttributes(kv ...attribute.KeyValue)
// TracerProvider returns a TracerProvider that can be used to generate