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

Thoughts on replacing mocks with Telemetry events #50

Open
ruslandoga opened this issue Nov 27, 2024 · 3 comments
Open

Thoughts on replacing mocks with Telemetry events #50

ruslandoga opened this issue Nov 27, 2024 · 3 comments

Comments

@ruslandoga
Copy link

ruslandoga commented Nov 27, 2024

👋

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:

@ruslandoga ruslandoga changed the title Replace mocks with Telemetry events Thoughts on replacing mocks with Telemetry events Nov 27, 2024
@ruslandoga
Copy link
Author

Small PoC: #47 (comment)

@Stratus3D
Copy link
Owner

flame_on and eflambe are separate project. flame_on used to use eflambe, but no longer does.

Can you explain what the benefit to stopping and starting via telemetry would be? Why not just use eflambe:capture/3?

@ruslandoga
Copy link
Author

ruslandoga commented Dec 2, 2024

👋 @Stratus3D

flame_on and eflambe are separate project.

I realize that. I thought they could both benefit from this idea so I opened this issue in both.

Can you explain what the benefit to stopping and starting via telemetry would be?

It allows removing mocking from production :)

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

No branches or pull requests

2 participants