-
Notifications
You must be signed in to change notification settings - Fork 897
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
Is it okay to use SQL statement type (e.g. just "SELECT") as span name? #1139
Comments
First, how do you get I very much prefer the John's idea from open-telemetry/opentelemetry-java-instrumentation#1409 (comment) |
👍
👍 |
Alternative proposition: what about statement type + main table name?
It's possible to implement that using a simple lexer (and the implementation won't be very complicated, I think). The downside of this solution is that it would cover only the most common/simple What do you think about that? |
I think with the current spec, this is all allowed, as it is not very strict:
I think we wanted to avoid requiring or suggesting to parse anything though. If you have a very long statement, I think the db.name suggestion applies. |
You still need to do simple parsing if you want to remove (potentially sensitive) arguments from a SQL query. |
Sure, the spec already has a few examples listed with |
Oh, I meant |
Hmm, what if you have more than one table? or what if you |
That actually sounds great. In case of nested queries or multiple tables
So for |
What are you trying to achieve?
Spec states that "SQL statement without variable arguments" are a good choice for DB span name, but sometimes SQL queries (especially ones generated by ORM frameworks like Hibernate) get terribly long and may have very high cardinality. E.g.
just for selecting a single entry. Imagine a query that eagerly fetches 3 tables joined together, each one having 15-20 columns, with some complex conditions -- and everything generated completely dynamically using
session.createCriteria()
(Hibernate again).Instead, would it be fine to use just
SELECT
(orINSERT
or ...) as span name? Full query should be available asdb.statement
anyway.The text was updated successfully, but these errors were encountered: