swift-distributed-tracing icon indicating copy to clipboard operation
swift-distributed-tracing copied to clipboard

Allow custom Baggage-Item to Logger Metadata transformation

Open slashmo opened this issue 4 years ago • 1 comments

In some cases it might make sense to split a single Baggage value into several Logger.Metadata values. E.g. a SpanContext which contains things like traceID, spanID, and traceFlags might want to log these as individual metadata values. This is currently not possible, as LoggingContext uses the CustomStringConvertible conformance of the stored type to convert it to a single metadata value.

A workaround for this is to store traceID, spanID, and traceFlags as individual Baggage items, but this could potentially lead to inconsistencies where some of these values might be stored while others aren't. E.g. what happens when a spanID is stored but no traceID?

Originated here: https://github.com/slashmo/opentelemetry-swift/issues/6

slashmo avatar Apr 06 '21 13:04 slashmo

That's one of the things to figure out how we want to answer for 1.0, assigning milestone

ktoso avatar Jul 04 '22 12:07 ktoso

I believe this is solved with the https://github.com/apple/swift-log/pull/238 metadata providers -- users can do "whatever they want" basically.

I'm going to close this as done.

ktoso avatar Feb 01 '23 04:02 ktoso