Add Enrich option for OpenTelemetry
See original GitHub issueI’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):
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:
- Created 2 years ago
- Reactions:2
- Comments:6 (4 by maintainers)
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.
Note: opened #4228 to specifically track span naming options.