Skip to content
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

Conversation

brennantaylor
Copy link

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.

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.
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 4, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: brennantaylor / name: Brennan Taylor (1d1dc96)

@brennantaylor brennantaylor changed the title otel gocql add span name formatters Add span name formatters to gocql instrumentation Dec 4, 2022
@codecov
Copy link

codecov bot commented Dec 5, 2022

Codecov Report

Merging #3047 (c6fe3e1) into main (e31186a) will increase coverage by 4.8%.
The diff coverage is 72.0%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #3047     +/-   ##
=======================================
+ Coverage   69.6%   74.4%   +4.8%     
=======================================
  Files        147       7    -140     
  Lines       6910     341   -6569     
=======================================
- Hits        4812     254   -4558     
+ Misses      1978      74   -1904     
+ Partials     120      13    -107     
Impacted Files Coverage Δ
...ntation/github.com/gocql/gocql/otelgocql/config.go 60.5% <50.0%> (+60.5%) ⬆️
...entation/github.com/gocql/gocql/otelgocql/gocql.go 100.0% <100.0%> (+100.0%) ⬆️
...ation/github.com/gocql/gocql/otelgocql/observer.go 75.1% <100.0%> (+75.1%) ⬆️
...ntation/google.golang.org/grpc/otelgrpc/version.go
....mongodb.org/mongo-driver/mongo/otelmongo/mongo.go
...n/github.com/Shopify/sarama/otelsarama/consumer.go
samplers/aws/xray/version.go
...on/google.golang.org/grpc/otelgrpc/test/version.go
...hub.com/emicklei/go-restful/otelrestful/restful.go
detectors/gcp/cloud-run.go
... and 142 more

@@ -71,7 +74,7 @@ func (o *OTelQueryObserver) ObserveQuery(ctx context.Context, observedQuery gocq

ctx, span := o.tracer.Start(
ctx,
observedQuery.Statement,
o.spanNameFormatter(observedQuery),
Copy link
Contributor

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.

@pellared
Copy link
Member

pellared commented Sep 6, 2023

Closing as otelgoclq is deprected per #4164.

@pellared pellared closed this Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants