newrelic/elixir_agent

A simple SELECT query is being categorized wrongly

mrz opened this issue · 2 comments

mrz commented

Describe the bug
We have a very simple SELECT 1 query in our application, called frequently as part of an infrastructural check. Recently it started to be categorized as {:other, :other}, and that's how it shows up in NR Database page (MySQL other other). We would love to have it categorized as a SELECT.

I managed to replicate the behavior in a standalone exs script by isolating NewRelic.Telemetry.Ecto.Metadata.parse_query/1 and confirming it returns the {:other, :other} tuple when given the SELECT 1 argument.

(Note: I think it might be enough to have parse_query/2 return {operation, :other} in the _ case, just to not lose the information on the type of operation performed, but don't know enough about the library to know what other effects that would have).

Environment

  • Elixir & Erlang version (elixir -v): Elixir 1.12.1
  • Agent version (mix deps | grep new_relic_agent): 1.27.2

parse_query/2 return {operation, :other}in the _ case

That sounds reasonable, I'd accept a PR that made this change. It could be tested easily here: https://github.com/newrelic/elixir_agent/blob/master/examples/apps/ecto_example/test/ecto_example_test.exs#L116

Fixed by #354