uptrace / opentelemetry-go-extra

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

[otelzap] What happened to WithTraceIDField option? #132

Open mminklet opened 3 months ago

mminklet commented 3 months ago

We are trying to find a way to force the trace id into the logs so we can more easily join our logs together when the trace isn't sampled (we could generate a new id but we're already using otelzap). This option appears to have been removed in the latest version at some point, and I was wondering why? It is still mentioned in the docs.

I see it was removed here https://github.com/uptrace/opentelemetry-go-extra/commit/3f68ff647621462a09ecfbbaa7629fc19b6418af

With the title convert otelzap to use logs api, but I don't know what that refers to or what the effect is, especially considering the tests were all removed. Is there any further information about this logs api? And specifically, how can I add the trace id to the log without wrapping otelzap and manually retrieving it

JPFrancoia commented 2 weeks ago

This option is only useful with backends that don't support OTLP and instead parse log

This is basically the case with GCP. They don't yet have a way to export logs. For traces and metrics yes, but not logs. It's very convenient to just add otelzap.WithTraceIDField(true) and have the logs immediately correlated with traces in GCP.

I had to revert to v0.2.4 to get this feature back. Is there any way we could consider bringing this back?

beni0888 commented 2 weeks ago

Same problem here 😞