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

Update SQL span name for procedures #7557

Merged
merged 1 commit into from
Jan 19, 2023
Merged

Update SQL span name for procedures #7557

merged 1 commit into from
Jan 19, 2023

Conversation

akats7
Copy link
Contributor

@akats7 akats7 commented Jan 12, 2023

This PR includes updates to the SQLSanitizer, DbClientSpanNameExtractor and SqlStatementInfo to name spans according to procedure name for CALL statements. The updates to the naming logic are in the SqlSanitizer and table has been renamed to identifier as using the table variable for the procedure name would not be idiomatic. SqlStatementInfo has been updated so that the db.sql.table attribute is not included for procedures.

@akats7 akats7 requested a review from a team as a code owner January 12, 2023 05:54
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 12, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: akats7 / name: Alex Kats (d598edb)

@mateuszrzeszutek
Copy link
Member

Hey @akats7 , looks like your GitHud ID is now being properly recognized. Can you sign the CLA?

@akats7 akats7 force-pushed the main branch 4 times, most recently from 8b92ae2 to 96bad86 Compare January 13, 2023 18:30
@akats7
Copy link
Contributor Author

akats7 commented Jan 13, 2023

Hey @akats7 , looks like your GitHud ID is now being properly recognized. Can you sign the CLA?

Hi @mateuszrzeszutek, I added myself to my orgs CLA and was approved but for some reason it doesn't seem to be linking it, I opened a support ticket

@jarias-lfx
Copy link

/easycla

Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

// Call
Arguments.of("call test_proc()", expect("CALL", "test_proc")),
Arguments.of("call test_proc", expect("CALL", "test_proc")),
Arguments.of("call next value in hibernate_sequence", expect("CALL", null)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not sure what happens, but may be a good test also)

Suggested change
Arguments.of("call next value in hibernate_sequence", expect("CALL", null)),
Arguments.of("call next value in hibernate_sequence", expect("CALL", null)),
Arguments.of("select next value in hibernate_sequence", expect("SELECT", null)),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akats7 sorry it looks like this comment got resolved accidentally, does it make sense to add this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trask Yep I did add it, its in the //Select section of the test cases

@akats7
Copy link
Contributor Author

akats7 commented Jan 19, 2023

Hey @trask @mateuszrzeszutek, I addressed your comments, please let me know if everything looks okay and I can squash the commit

Copy link
Member

@mateuszrzeszutek mateuszrzeszutek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
Left a couple of minor comments, but overall it LGTM 👍

@@ -43,6 +43,7 @@ public static <REQUEST, RESPONSE> SqlClientAttributesExtractorBuilder<REQUEST, R
return new SqlClientAttributesExtractorBuilder<>(getter);
}

private static final String SQL_CALL = "CALL";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: just a blank line to separate constants from fields:

Suggested change
private static final String SQL_CALL = "CALL";
private static final String SQL_CALL = "CALL";

@akats7
Copy link
Contributor Author

akats7 commented Jan 19, 2023

Ignore the close, I somehow accidentally clicked close PR 😄

@@ -40,24 +41,24 @@ public static <REQUEST> SpanNameExtractor<REQUEST> create(

private DbClientSpanNameExtractor() {}

protected String computeSpanName(String dbName, String operation, String table) {
protected String computeSpanName(String dbName, String operation, String identifier) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you rename identifier -> mainIdentifier?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

@trask trask merged commit eaac709 into open-telemetry:main Jan 19, 2023
@trask
Copy link
Member

trask commented Jan 19, 2023

thx @akats7!

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

Successfully merging this pull request may close these issues.

None yet

4 participants