newrelic / elixir_agent

New Relic's Open Source Elixir Agent

Home Page:https://hex.pm/packages/new_relic_agent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No transactions for Absinthe

cshanes opened this issue · comments

Describe the bug
After setting up the new_relix_elixir agent and new_relic_absinthe agent, the only data that shows up in the New Relic dashboard are database queries. No transactions.

I did add it to the middleware like so:

  def middleware(middleware, _field, %Absinthe.Type.Object{
        identifier: identifier
      })
      when identifier in [:query, :subscription, :mutation] do
    [NewRelic.Absinthe.Middleware, Instrument, RequestLogger] ++ middleware
  end

Environment

  • Elixir & Erlang version: Erlang/OTP 23, Elixir 1.11.3
  • Agent version: new_relic_agent 1.23.6, new_relic_absinthe 0.0.4
  • Absinthe version: absinthe 1.5.5

Am I missing additional configuration?

Just to add a bit more information, I spent time adding debug output to the New Relic middleware and confirmed the complete function (https://github.com/binaryseed/new_relic_absinthe/blob/master/lib/new_relic/absinthe/middleware.ex#L42) is getting called. I printed out some of the values and everything looks fine as far as I can tell:

span: 
{["roundSubmissionPerformance", "roundDailyPerformances"],
 #Reference<0.2859887835.2323906562.39014>}
primary name: APITournament.Models.UserProfile.round_daily_performances_resolver
secondary name: APITournament.Schemata.roundSubmissionPerformance.roundDailyPerformances

It looks like we need to add Telemetry support for Absinthe maybe?

I started that a while back, the branch is here: https://github.com/binaryseed/elixir_agent/commits/absinthe-telemetry I never got around to finishing it...

It requires an extension of the span reporting API that's not quite so simple. Spans via Absinthe don't have a reliable nested "parenting" relationship and that's what the automatic @trace based span generation relies on. Parenting has to be tracked manually using the id emitted in the telemetry events

@tpitale @binaryseed Hi, I think this pr #375 can solve the "parenting" problem.