Skip to content

Thoughts on replacing mocks with Telemetry events#50

Description

@ruslandoga

馃憢

Originally posted in DockYard/flame_on#48


Similar to the issue above, what if eflambe starts and stops tracing on telemetry events?

Since telemetry:execute and telemetry:span run in the caller process, we have access to the current pid, and we can use the new trace module with very minimal effort for flamegraphs. Flamecharts (which is what FlameOn is doing, and I guess eflambe as well?) would require extra effort. With trace we might also be able to cross process boundary and start tracing the processes that the current process "calls".

The API could be just a telemetry event for which to start tracing, and an optional event for when to stop tracing.

ref = make_ref()
# or something like :eflambe.trace_once([:phoenix, :endpoint, :start])
:telemetry.attach("trace-phx-on", [:phoenix, :endpoint, :start], &:eflambe.start_tracing/4, sample: 0.01, ref: ref)
:telemetry.detach("trace-phx-on")
:eflambe.svg(:eflambe.report(ref))

Context:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions