-
Notifications
You must be signed in to change notification settings - Fork 534
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
perf(instrumentation-pg): do not split query to determine operation name #2029
Conversation
@@ -81,7 +81,12 @@ export function getQuerySpanName( | |||
} | |||
|
|||
function parseNormalizedOperationName(queryText: string) { |
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.
your commit message says you're changing how to get the "span name", but your changes are on the "operation name" function (even if that is later used to get the span), so probably worth updating commit message/PR title to reflect that.
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.
Done
curious, do we care about the case |
24e1ceb
to
f02641f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2029 +/- ##
==========================================
- Coverage 90.97% 90.38% -0.60%
==========================================
Files 146 147 +1
Lines 7492 7506 +14
Branches 1502 1573 +71
==========================================
- Hits 6816 6784 -32
- Misses 676 722 +46
|
I personally do not find all this logic and span names very helpful in my work, I will create issue, seems better to discuss it via that |
This issue is discussed in semantic conventions for database spans here:
So I support removing any parsing of the query to be compliant with spec and to not introduce any extensive processing. Perhaps the span name should be in this case the dbName? |
Which problem is this PR solving?
OTEL allocates too much
Short description of the changes
To determine span name from query text currently query is split by whitespace. With typical SQL statement being many tens of words long this is wasteful. Replaced the logic with finding the index of first whitespace. This can be optimize further to avoid double slicing for COMMIT case, but this turns out to have a lot of indexing and conditions gymnastics