Skip to content

Commit

Permalink
migrated to new otelgrpc API for tracing (#2329)
Browse files Browse the repository at this point in the history
### Why?
<!-- author to complete -->
<!-- Please explain to us why we need this change. -->
Fixes : #2237 

### What?
<!-- Please explain to us what does it do? Or let the copilot handle it.
-->
migrated to new otelgrpc API for tracing.

Took reference from
[here](https://github.com/open-telemetry/opentelemetry-go-contrib/pull/4534/files#diff-45cde3191bd791caddf95c9ecc377397c29d85b4a4bfe81c5e5afbb5489d2ca7)

### How?
<!-- Please explain to us how should it work? Or let the copilot handle
it. -->

### Test Plan
<!-- How did you test it? How can we test it? -->
Screen shots from jaeger UI run using `scripts/local-observability` 


![image](https://github.com/parca-dev/parca-agent/assets/56021229/5abca66c-5b76-4309-8140-3085f0c26a23)


![image](https://github.com/parca-dev/parca-agent/assets/56021229/7725c877-56ce-43f5-9bdb-c6ea4be4cee3)
  • Loading branch information
kakkoyun committed Dec 19, 2023
2 parents 7ef5450 + 8c6e51f commit c0c0c9b
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions pkg/grpc/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,27 +112,21 @@ func Conn(logger log.Logger, reg prometheus.Registerer, tp trace.TracerProvider,
// `WithPerRetryTimeout` allows you to shorten the deadline of each retry call, allowing you to fit multiple retries in the single parent deadline.
retry.WithPerRetryTimeout(2*time.Minute),
),
//nolint:staticcheck
tracing.UnaryClientInterceptor(
tracing.WithTracerProvider(tp),
tracing.WithPropagators(propagators),
),
metrics.UnaryClientInterceptor(
grpc_prometheus.WithExemplarFromContext(exemplarFromContext),
),
logging.UnaryClientInterceptor(interceptorLogger(logger), logging.WithFieldsFromContext(logTraceID)),
),
grpc.WithChainStreamInterceptor(
//nolint:staticcheck
tracing.StreamClientInterceptor(
tracing.WithTracerProvider(tp),
tracing.WithPropagators(propagators),
),
metrics.StreamClientInterceptor(
grpc_prometheus.WithExemplarFromContext(exemplarFromContext),
),
logging.StreamClientInterceptor(interceptorLogger(logger), logging.WithFieldsFromContext(logTraceID)),
),
grpc.WithStatsHandler(tracing.NewClientHandler(
tracing.WithTracerProvider(tp),
tracing.WithPropagators(propagators),
)),
)

return grpc.Dial(address, opts...)
Expand Down

0 comments on commit c0c0c9b

Please sign in to comment.