-
Notifications
You must be signed in to change notification settings - Fork 385
[sql] Implement updates to new semantic conventions for stored procedures #2693
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
Merged
Kielek
merged 5 commits into
open-telemetry:main
from
alanwest:alanwest/db-stored-procedure-name
May 5, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8c4d43f
Add db.stored_procedure.name attribute
alanwest ae1b39c
Update changelog
alanwest 71100dd
Update changelog
alanwest 8013e00
Merge branch 'main' into alanwest/db-stored-procedure-name
Kielek c61d3bc
Merge branch 'main' into alanwest/db-stored-procedure-name
Kielek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trask @lmolkova @maryliag
Wanted to check with you all to confirm this meets the spirt of the recent changes regarding stored procedures.
db.operation.name. I was arbitrarily setting it toEXECUTEbefore since there was no "operation" present in the query text.db.collection.nameanddb.query.textsince their values would simply be the same asdb.stored_procedure.namemaking them redundant.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, once I add
db.query.summaryshoulddb.query.summary=db.stored_procedure.name?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
db.collection.nameshouldn't be captured since it's not a collectionI would expect
db.query.textto be captured if the stored proc is run via a query API (where you pass SQL), but from a non-query API where you explicitly pass a stored proc namedb.operation.nameis a good question. I think if it's not a query API (where you pass SQL), then we should capturedb.operation.name(but I suspect spec may not be clear about this)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think Java has a non query API for calling stored procedures
https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html#prepareCall-java.lang.String-
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference between using the "non-query" vs "query" API when invoking a stored procedure in C# is subtle.
"Non-query API"
This will be the more common way to invoke a stored procedure.
This is what I think you're proposing:
db.stored_procedure.name=some_stored_proceduredb.operation.name=EXECUTEorCALLorEXECor ... maybe this is where the spec could be more cleardb.query.summary=EXECUTE some_stored_procedure(orCALLorEXEC)db.query.textis not set"Query API"
This will likely be less common, but still possible.
I guess in this scenario we might only be able to set
db.query.text.db.stored_procedure.nameis not setdb.operation.nameis not setdb.query.text=some_stored_procedure @some_parameterdb.query.summary= ??? (it might be possible to parse the query text and safely infer that it is likely a stored procedure)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
I'm thinking it should be
some_stored_procedurebased on:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now filed: open-telemetry/semantic-conventions#2207
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm. but the query sent to DB would be
EXEC some_stored_procedureand operation.name would be EXEC, so summary should beEXEC some_stored_procedure.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the way I understood the discussion above is that in this case:
the query sent to the DB would just be
some_stored_procedureThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, that's correct.