question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OpenTelemetry integration misses the point: we need to propagate the span/context!

See original GitHub issue

The code where the Subscriber reads the span from the attributes just creates the span and then throws it away: https://github.com/googleapis/nodejs-pubsub/blob/99107930bbed8e29834acb2347f65efc6a39958f/src/subscriber.ts#L517-L527

A good OpenTelemetry customer would then set the span to the current span in the on("message") handler, so that any subsequent processing is attached to the remote span.

I’ll also file a Google support case.

Environment details

  • @google-cloud/pubsub version: master / v2.17.0

Steps to reproduce

  1. Enable OpenTelemetry in both publisher and subscriber using { enableOpenTelemetryTracing: true } options on topic and subscription.
  2. Perform some processing that creates spans, either manually or (for example) do a Datastore Query or Put.

It can be observed that actions are linked to the subscriber span, as can also be seen in this screenshot (spans take <1ms because nothing is done inside): Screenshot 2021-08-30 at 16 47 23

Relates to #1078.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
feywindcommented, Aug 3, 2022

Sorry for the radio silence on this topic, but it’s still a major objective for us. None of this is official until it’s official (please don’t take it as an announcement/promise), but the current thought is that we’re planning to shift it to use the more standard mechanism (w3c headers), and to get it piped all the way through. A preview of the Go version produces a really nice graph in Cloud Trace, showing the time spent in each phase of the library (batching, ack leasing, etc). There isn’t currently anything that will be traced in the server, but the end to end trace should at least allow you to see how long it spends in the server before being sent out.

2reactions
feywindcommented, Dec 22, 2022

Mentioned in the PR, but mentioning here too: there’s a suuuuper early preview branch now if anyone wants to play around with what’s done. I don’t recommend using it in any kind of production scenario or assuming any of the interfaces or trace formats are final.

That PR is here: https://github.com/googleapis/nodejs-pubsub/pull/1659

And the branch in googleapis that anyone can make PRs against if you want: https://github.com/googleapis/nodejs-pubsub/tree/otel-2

I’ll be out for a bit but plan to pick it up again in early 2023.

Read more comments on GitHub >

github_iconTop Results From Across the Web

open-telemetry/opentelemetry-java - Gitter
I 'm wondering whether io.opentelemetry.sdk.trace.export.SimpleSpansProcessor.Config.Builder#build needs to be declared public . Without it, there's no way to ...
Read more >
Traces | OpenTelemetry
It serializes or deserializes Span Context and provides the relevant Trace information to be propagated from one service to another. We now have...
Read more >
Distributed Tracing for Kafka with OpenTelemetry | New Relic
Ideally, you should be using distributed tracing to trace requests through ... a month or approximately nine million data points per second.
Read more >
OpenTelemetry: beyond getting started | by Sergey Kanzhelev
For this to work, you need integrations with every language, web framework, RPC system, ... OpenTelemetry has a lot of extensibility points.
Read more >
Enable Azure Monitor OpenTelemetry for .NET, Node.js, and ...
If you have two or more services that emit telemetry to the same Application Insights resource, you're required to set Cloud Role Names...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found