-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instrumenting gorm SQL logging with otelgorm and otelzap #66
Comments
Ultimately we're not blocked by this. We don't want to log fully unredacted SQL, so we won't enable gorm's Logger in production — and we don't really need tracing in pre-production. |
Another way to mitigate this: change otelzap to always add |
Using a gorm.Plugin sounds like a proper solution here if you want queries with trace ids in your logs.
I'd assume trace id to be zero if span is not recording. |
It remains available. Before I tried otelzap, we had a small hook to add it without checking |
Hi. First, thanks for the great work instrumenting these libs!
I came across this issue while setting up otelgorm and otelzap.
Problem: when configuring gorm with both otelgorm and an otelzap logger, the otelzap logger will not emit span events or add span attributes (like a trace_id), for SQL logging.
I.e., configure gorm with:
I think this happens because: gorm calls otelgorm before calling its configured logger (see here), so:
I see two ways to fix this:
The second one is a hack the user might build if (1) instrumented SQL logging is very important and (2) we can't change gorm.
The text was updated successfully, but these errors were encountered: