Skip to content

Name jdbc spans according to db operation/procedure name and not database name #6765

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

Closed
akats7 opened this issue Sep 27, 2022 · 9 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@akats7
Copy link
Contributor

akats7 commented Sep 27, 2022

Is your feature request related to a problem? Please describe.
We are exporting trace data to New Relic and want to use the database transaction tab to identify db operations that are the most time consuming/ introducing the most latency. However, NR queries the db transaction off the name of the span which in this case (due to the lack of support for procedures) is db_name. This makes it very difficult to identify which db operations are causing issues.

Describe the solution you'd like
I would like the jdbc spans to be named according to the operation (i.e, in the case of stored procedures, name according to the stored procedure name),

Additional context
I'm looking on guidance on this, is there a reason this wasn't the default functionality, and if it deemed to be useful I'd be happy to discuss some approaches.

@akats7 akats7 added the enhancement New feature or request label Sep 27, 2022
@trask
Copy link
Member

trask commented Sep 30, 2022

hi @akats7!

I believe the jdbc span name should be <db.operation> <db.name>.<db.sql.table>, but it sounds like you are only seeing <db.name>?

that could be happening if we aren't able to parse out the operation and table from the query, so would be helpful to see specific queries and resulting span names you are seeing.

@akats7
Copy link
Contributor Author

akats7 commented Oct 13, 2022

Hi @trask,

Thanks for the reply, so it looks like even when all of the fields are able to be extracted, the span would be something along the lines of INSERT postgres.table1, what I was wondering is if it would be of interest for the name to essentially be spInsertUser, that way I can actually delineate which procedures are taking longer than others as many procedures might have the same <db.operation> <db.name>.<db.sql.table> permutation

@trask
Copy link
Member

trask commented Oct 14, 2022

hey @akats7, are you specifically referring to the naming of stored procedures? maybe if you could give a few examples of complete sql statements and how you would propose to name them it might help to clarify, thx!

@akats7
Copy link
Contributor Author

akats7 commented Oct 25, 2022

Hi @trask, yes I'm specifically referring to called stored procedures, is the proper naming for a stored procedure in the format "Call db_name.procedure_name", this seems to be the case when I see only the db.name get parsed out, and in turn the span is named "db_name"

@trask
Copy link
Member

trask commented Oct 25, 2022

yes I'm specifically referring to called stored procedures

makes sense to me, as stored procedure names are cardinality limited

stored procedures are even called out explicitly in the spec:

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)

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/database.md#semantic-conventions-for-database-client-calls

@akats7
Copy link
Contributor Author

akats7 commented Nov 3, 2022

Hi @trask, just wanted to clarify, is this a valid enhancement. Just want to ensure that similar instrumentation does not already exist/existed in the past within the agent.

@trask
Copy link
Member

trask commented Nov 3, 2022

just wanted to clarify, is this a valid enhancement

I believe so

@akats7
Copy link
Contributor Author

akats7 commented Nov 15, 2022

Can I please be assigned this issue

@mateuszrzeszutek
Copy link
Member

Fixed by #7557

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

No branches or pull requests

3 participants