newrelic / newrelic-java-agent

The New Relic Java agent
Apache License 2.0
202 stars 143 forks source link

Slow SQL traces not received in the expected section from New Relic Java agent #1937

Closed devleifr closed 3 months ago

devleifr commented 4 months ago

Description

I'm experiencing an issue with the New Relic Java agent where Slow SQL traces are not shown in the New Relic dashboard. I can see these SQL-connected traces under Monitor > Transactions and they are categorized under the .other segment.

Additionally, I did not find any enable/disable option for Slow SQL traces like those available in other language agents.

Expected Behavior

Slow SQL traces should appear in the New Relic dashboard under the Monitor > Databases > Slow SQL traces section.

Troubleshooting

The Slow SQL traces section is empty: Screenshot from 2024-06-11 16-31-30

SQL-connected traces under Monitor > Transactions:

Screenshot from 2024-06-11 17-18-42

Screenshot from 2024-06-11 17-18-08

Screenshot from 2024-06-11 16-54-28

Screenshot from 2024-06-11 17-17-16
Screenshot from 2024-06-11 17-17-27

Steps to Reproduce

Specify your license key under the NEW_RELIC_LICENSE_KEY variable in docker-compose.yml. Then run docker compose up --build.

java_nr_sql_repro.zip

Environment Details:

workato-integration[bot] commented 4 months ago

https://new-relic.atlassian.net/browse/NR-279519

jbedell-newrelic commented 3 months ago

Hi @devleifr,

So far I've been unable to reproduce this issue. My slow SQL queries are showing up in the expected UI page. Can you share a little more information about your setup?

devleifr commented 3 months ago

Hi @devleifr,

So far I've been unable to reproduce this issue. My slow SQL queries are showing up in the expected UI page. Can you share a little more information about your setup?

Hi @jbedell-newrelic! Have you tried the reproduction spring application that I provided in "Steps to reproduce"?

jbedell-newrelic commented 3 months ago

@devleifr I'm sorry to say I somehow completely missed that. Thanks for the reminder.

jbedell-newrelic commented 3 months ago

Hi @devleifr It looks like your repro app does a simple select pg_sleep() call. We refer to this as a select VARIABLE call, and that type of call is never going to report a metric up.

Is that representative of the problem query in your actual application?

If so and would like it to show up, you may try to append an arbitrary from <table_name> to the query, which should parse differently and should produce a metric being sent up.

jbedell-newrelic commented 3 months ago

Going to be closing this issue. If you need to re-open it, please feel free.