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

@trace attribute rewriting ignored cons arguments #366

Open
nathanjohnson320 opened this issue Oct 25, 2021 · 1 comment · May be fixed by #465
Open

@trace attribute rewriting ignored cons arguments #366

nathanjohnson320 opened this issue Oct 25, 2021 · 1 comment · May be fixed by #465

Comments

@nathanjohnson320
Copy link

nathanjohnson320 commented Oct 25, 2021

Describe the bug

When adding @trace to a function with an ignored list tail the macro creates an improper list with :__ignored__ as the tail instead of creating an ignored tail variable.

Below is an example module that produces the issue

defmodule Test do
  use NewRelic.Tracer

  @trace :example
  def example([a | _ignored]) do
    IO.inspect([a])
  end

This code will raise warnings in dialyzer which say that the list is improper
image

And then below I logged out what the Tracer build_call_args/1 returns with and without the rewrite_call_term postwalk

with trace
"[[a | :__ignored__]]"

without trace
"[[a | _ignored]]"

Environment

  • Elixir & Erlang version (elixir -v): Elixir 1.12.1 (compiled with Erlang/OTP 22)
  • Agent version (mix deps | grep new_relic_agent): 1.27.4
  • macOS 11.6
@binaryseed
Copy link
Collaborator

This one is interesting, we need to "re write" the arguments of the function so we can log the function call itself. The :__ignored__ atom is stuck in there to avoid compiler warnings

The code is here:

I'm not sure what to re-write it to here, but it should be possible to craft a test for this, detect the situation & do something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants