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.

Add Enrich option for OpenTelemetry

See original GitHub issue

I’m using the new OpenTelemetry stuff and it’s great. It was trivial to add and immediately instrumented my queries. Thanks so much!

However,the traces weren’t super useful. Here’s an example of how this looks in my tracing provider (this is honeycomb):

image

Every SQL query span is called the name of the DB being accessed. This makes it difficult to understand what’s going on at a glance.

I looked in the code, and there doesn’t seem to be any configuration ability here.

It seems the standard way to customize an Activity in .NET is to use an Enrich field in the OpenTelemetryOptions. Here is one example, but I believe all the libraries I’ve seen have this.

The things that I would like to “Enrich” are to change the name of the source (maybe I can do that using DisplayName) and to list some parameters to add as Tags.

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
rojicommented, Dec 4, 2021

Agreed. Npgsql could potentially even provide the functionality to do the parsing, with adequate warning to proceed at your own risk.

This isn’t something we’re likely to do - we very intentionally avoid parsing SQL in the driver (quite a lot of work in Npgsql 6.0 went towards allowing executing command without looking at the SQL at all). Finding even a table name in the SQL can be an extremely complicated exercise, with multiple tables being present, more complicated SQL constructs (e.g. common table expressions with WITH), etc.

If users would like to plug in some external component to do the parsing for them, they should have the possibility of doing so, but I don’t think we’ll provide that component.

0reactions
rojicommented, Dec 20, 2021

Note: opened #4228 to specifically track span naming options.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enrich your logs with the OpenTelemetry Collector
One way to enrich your logs is to add additional metadata using the OpenTelemetry Collector. OpenTelemetry is a vendor-agnostic, open-source ...
Read more >
Configuring OpenTelemetry Agents to Enrich Data and ...
The Add Resource Attribute processor can be used to enrich telemetry by adding resources to all metrics, traces, and logs in the pipeline....
Read more >
Enrich OpenTelemetry spans with contextual information
OpenTelemetry (spec + .NET) has a Baggage API you can use to attach data to a span. You could add your contextual information...
Read more >
c# - Enrich callback not being called in OpenTelemetry.net, ...
So I've added an enrich callback with the purpose of adding each parameter as a tag: appBuilder.Services.AddOpenTelemetryTracing((builder) ...
Read more >
Manual Instrumentation
Log context instrumentation​​ OpenTelemetry provides components which enrich log context with trace context for various popular Java log frameworks: Log4j ...
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