uptrace / opentelemetry-go-extra

OpenTelemetry instrumentations for Go
https://uptrace.dev/get/instrument/
BSD 2-Clause "Simplified" License
314 stars 72 forks source link

feat: add support for span id and custom key for trace id and span id for otelzap #126

Closed pragmaticivan closed 5 months ago

pragmaticivan commented 5 months ago

fixes #109

vmihailenco commented 5 months ago

Thanks for the PR, but otelzap now uses Otel Logs API which has top-level fields for trace & span ids.

pragmaticivan commented 5 months ago

Hi @vmihailenco could you clarify that? this PR is backward compatible, it happens that many vendors don't follow the same API yet and this would be required to support New Relic for example.

vmihailenco commented 5 months ago

@pragmaticivan otelzap now does not inject trace_id/span_id and instead relies on Otel Logs API to do it automatically: https://github.com/uptrace/opentelemetry-go-extra/blob/main/otelzap/otelzap.go#L164-L196

And Otel Logs API will set trace/span ids on the log.Record structure directly without using attributes.

vmihailenco commented 5 months ago

would be required to support New Relic for example.

New Relic would just need to support OpenTelemetry Logs API.