Skip to content
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

Allow naming otelsql spans by db.operation #118

Open
joshmgross opened this issue Feb 16, 2024 · 0 comments
Open

Allow naming otelsql spans by db.operation #118

joshmgross opened this issue Feb 16, 2024 · 0 comments

Comments

@joshmgross
Copy link

Spans from otelsql have static names like db.Query and db.Exect

Per https://opentelemetry.io/docs/specs/semconv/database/database-spans/

The span name SHOULD be set to a low cardinality value representing the statement executed on the database. It MAY be a stored procedure name (without arguments), DB statement without variable arguments, operation name, etc. Since SQL statements may have very high cardinality even without arguments, SQL spans SHOULD be named the following way, unless the statement is known to be of low cardinality: <db.operation> <db.name>.<db.sql.table>, provided that db.operation and db.sql.table are available. If db.sql.table is not available due to its semantics, the span SHOULD be named <db.operation> <db.name>.

We should add the ability for otelsql spans to follow this naming convention.

The same guidelines do not recommend parsing the db.statement, so we'd need some other way to pass this information to otelsql:

It is not recommended to attempt any client-side parsing of db.statement just to get these properties, they should only be used if the library being instrumented already provides them. When it’s otherwise impossible to get any meaningful span name, db.name or the tech-specific database name MAY be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant