Skip to content

Missing traces on attribute calls #14462

Open
Open
@lukaszsamson

Description

@lukaszsamson

Elixir and Erlang/OTP versions

Erlang/OTP 27 [erts-15.2.5] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

Elixir 1.18.3 (compiled with Erlang/OTP 27)

Operating system

any

Current behavior

The following code example when a call on attribute happens inside module body do not emit remote_function tracer events

defmodule Foo do
  @x Enum

  @x.count([])
end

Only alias_reference is emitted here.

Compare that with the call in function body which emits the event

defmodule Foo do
  @x Enum

  def go do
    @x.count([])
  end
end

Or indirect call

defmodule Foo do
  Enum.count([])
end

Similarly, a capture call will not emit the event in module body

defmodule Foo do
  @x (&Enum.count/1)

  @x.([])
end
defmodule Foo do
  import Enum

  @x (&count/1)

  @x.([])
end

But will emit in function body

defmodule Foo do
  @x (&Enum.count/1)

  def go do
    @x.([])
  end
end

Additionally, if a module variable is used instead of an attribute the same bahaviour can be observed - no trace events emitted

defmodule Foo do
  x = Enum

  x.count([])
end

defmodule Foo do
  x = (&Enum.count/1)

  x.([])
end

As far as I can tell, the compile time dependencies are correctly set

Expected behavior

The calls in the examples with attributes should emit tracer events. I'm not sure about the calls on module variable.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions