Skip to content

Conversation

@ecarrizo2
Copy link
Contributor

@ecarrizo2 ecarrizo2 commented Dec 3, 2025

Which problem is this PR solving?

This PR intends to solves bug #3265.
Removing leading and trailing whitespaces when parsing and extracting the command from query text.

Actual Behavior:
When calling get query span name with leading spaces in the query text, the spaces are translated into the Span
e.g utils.getQuerySpanName('dbName', { text: ' SELECT $1' }) results in pg.query: SELECT dbName

Intended Behavior
Leading spaces are removed utils.getQuerySpanName('dbName', { text: ' SELECT $1' }) results in pg.query: SELECT dbName

Short description of the changes

Offtopic and other notes

While reviewing other modules also found that packages/instrumentation-mysql/src/utils.ts and packages/instrumentation-mysql2/src/utils.ts use similar methods that may need revision.

@ecarrizo2 ecarrizo2 requested a review from a team as a code owner December 3, 2025 18:44
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 3, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: pichlermarc / name: Marc Pichler (ab347fa)

@github-actions github-actions bot requested a review from maryliag December 3, 2025 18:44
@ecarrizo2 ecarrizo2 changed the title fix(instrumentation-pg): normalize trailing spaces in database operation name fix(instrumentation-pg): normalize leading/trailing spaces in database operation name Dec 3, 2025
@pichlermarc pichlermarc enabled auto-merge (squash) December 4, 2025 08:59
@pichlermarc pichlermarc disabled auto-merge December 4, 2025 08:59
@pichlermarc pichlermarc enabled auto-merge (squash) December 4, 2025 08:59
@pichlermarc pichlermarc linked an issue Dec 4, 2025 that may be closed by this pull request
@pichlermarc pichlermarc merged commit 1102cfa into open-telemetry:main Dec 4, 2025
20 checks passed
@otelbot
Copy link
Contributor

otelbot bot commented Dec 4, 2025

Thank you for your contribution @ecarrizo2! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

instrumentation-pg: operation name should be trimmed

4 participants