-
Notifications
You must be signed in to change notification settings - Fork 582
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
Add span name formatters to gocql instrumentation #3047
Add span name formatters to gocql instrumentation #3047
Conversation
Currently the observers hardcode the span names without allowing customization. In particular the queries are just the statements executed and I have found these to contain whitespace like tabs and multi line statements with indentation. By allowing span name formatters similar to otelhttp the user can customize the span names to their heart's desire.
|
@@ -71,7 +74,7 @@ func (o *OTelQueryObserver) ObserveQuery(ctx context.Context, observedQuery gocq | |||
|
|||
ctx, span := o.tracer.Start( | |||
ctx, | |||
observedQuery.Statement, | |||
o.spanNameFormatter(observedQuery), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be a bit more defensive about these not being nil. If a user does With*SpanNameFormatter(nil)
this will panic.
I would suggest adding a nil check either after apply's or before used in creating the Observers.
Closing as |
Currently the observers hardcode the span names without allowing customization.
In particular the queries are just the statements executed and I have found these to contain whitespace like tabs and multi line statements with indentation.
By allowing span name formatters similar to otelhttp the user can customize the span names to their heart's desire.