From ce499ec0ffec5bd7bfca7cff10301b3ecdd4c2ef Mon Sep 17 00:00:00 2001 From: Vince Foley Date: Thu, 2 Jan 2025 17:44:18 -0800 Subject: [PATCH] Fix dializyer complaint about trace_info --- lib/new_relic/tracer/macro.ex | 10 ++++++++-- lib/new_relic/tracer/report.ex | 7 +------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/new_relic/tracer/macro.ex b/lib/new_relic/tracer/macro.ex index a8ce2333..191941db 100644 --- a/lib/new_relic/tracer/macro.ex +++ b/lib/new_relic/tracer/macro.ex @@ -176,8 +176,14 @@ defmodule NewRelic.Tracer.Macro do end def traced_function_body(body, module, function, args, trace_info) do + trace_annotation = + case trace_info do + {name, options} -> {name, options} + name -> {name, []} + end + quote do - with {_, opts} <- unquote(trace_info), + with {_, opts} <- unquote(trace_annotation), :external <- Keyword.get(opts, :category) do Process.put(:nr_already_tracing_external, true) end @@ -231,7 +237,7 @@ defmodule NewRelic.Tracer.Macro do Tracer.Report.call( {unquote(module), unquote(function), unquote(build_call_args(args))}, - unquote(trace_info), + unquote(trace_annotation), inspect(self()), {span, previous_span || :root}, {start_time, start_time_mono, end_time_mono, child_duration_ms, reductions} diff --git a/lib/new_relic/tracer/report.ex b/lib/new_relic/tracer/report.ex index 0d6107c4..3d099a47 100644 --- a/lib/new_relic/tracer/report.ex +++ b/lib/new_relic/tracer/report.ex @@ -16,12 +16,7 @@ defmodule NewRelic.Tracer.Report do edge, timing ) do - {name, options} = - case trace_annotation do - {name, options} -> {name, options} - name -> {name, []} - end - + {name, options} = trace_annotation category = Keyword.get(options, :category, :function) report(