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

MySQL span name truncated to "/*" with inline comments in query #4490

Open
1 of 3 tasks
ben-queenlive opened this issue Mar 9, 2025 · 0 comments
Open
1 of 3 tasks

Comments

@ben-queenlive
Copy link

Describe the bug

When using inline comments in MySQL queries, the APM span name only shows /* instead of the actual SQL query. This makes it difficult to identify and monitor specific database operations in the APM UI.

To Reproduce

Steps to reproduce the behavior:

  1. Configure Elastic APM Node.js agent and set up MySQL connection
  2. Execute a query with inline comment like:
/* GetUserProfile */ SELECT * FROM users WHERE id = 1
  1. Check the transaction in APM UI
  2. Transaction name is shown generically as '/* ', ignoring the inline comment 'SELECT * FROM users'
    Expected behavior

The span name should display the actual SQL query (e.g., "SELECT * FROM users") rather than just showing /*. This would provide proper visibility into the database operations being performed and make it easier to monitor and debug database queries.

Environment (please complete the following information)

  • OS: macOS 14.3
  • Node.js version: 22.7.0
  • APM Server version: 8.12.0
  • Agent version: 4.11.0

How are you starting the agent? (please tick one of the boxes)

  • Calling agent.start() directly (e.g. require('elastic-apm-node').start(...))
  • Requiring elastic-apm-node/start from within the source code
  • Starting node with -r elastic-apm-node/start

Additional context

Agent config options:

Click to expand
ELASTIC_APM_SERVER_URL=
ELASTIC_APM_SECRET_TOKEN=
ELASTIC_APM_CAPTURE_BODY=error
ELASTIC_APM_TRANSACTION_SAMPLE_RATE=1.0
ELASTIC_APM_ACTIVE=true 

package.json dependencies:

Click to expand
{
  "dependencies": {
    "elastic-apm-node": "^4.11.0",
    "mysql2": "^3.12.0",
    "@nestjs/common": "^11.0.0",
    "@nestjs/core": "^11.0.0",
    "@nestjs/typeorm": "^11.0.0",
    "typeorm": "^0.3.20"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant