apple / swift-distributed-tracing

Instrumentation library for Swift server applications
https://swiftpackageindex.com/apple/swift-distributed-tracing/main/documentation/tracing
Apache License 2.0
224 stars 34 forks source link

Allow for reading and mutating a span name #88

Closed ktoso closed 1 year ago

ktoso commented 1 year ago

Motivation:

The feature frozen otel specification allows for renaming spans after they have been started. This often is too late to impact sampling decisions, however we still can use to to provide better names for spans as time goes on.

Modifications:

add an operationName to the Span protocol.

A span has to be thread-safe already and we have mutating operations on it already so it does not change the complexity requirements on implementing a span.

Result:

Be closer to otel spec and more flexible in naming and renaming spans. Resolves https://github.com/apple/swift-distributed-tracing/issues/48

ktoso commented 1 year ago

If unsure about this feature, please check the https://github.com/apple/swift-distributed-tracing/issues/48 discussion and otel's justification which I think is reasonable https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#updatename