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

Fix: Add ETS buffering for telemetry events in TelemetryListener #450

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

techvoyagerX
Copy link

This PR improves the handling of high event rates in the Phoenix Live Dashboard by introducing an ETS-based buffering system in TelemetryListener. It ensures that events are buffered efficiently and prevents system overload by trimming the buffer when necessary.

Key changes:

  • Added ETS table for event buffering.
  • Introduced buffer overflow handling to maintain system stability under high loads.
  • Cleaned up ETS table on process termination.

These updates ensure the metrics page continues to function smoothly even under high telemetry event loads.

@@ -95,6 +111,9 @@ defmodule Phoenix.LiveDashboard.TelemetryListener do
:telemetry.detach({__MODULE__, event, self()})
end

# Clean up ETS table
:ets.delete(:dashboard_telemetry)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to delete it, the table is automatically GCed if the process terminates.

@josevalim
Copy link
Member

Thank you for the PR but I am confused. We never read from the table. How does this help with buffering?

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 this pull request may close these issues.

2 participants