Conversation
Peep.Storage implementation using N ETS tables with optional tag-based routing. Each metric write is routed to a specific table based on a `:routing_tag` option. If the routing tag is present in the metric's tags, `:erlang.phash2/2` is used to select the table. Otherwise, the first table is used. This reduces lock contention by routing different tag values (e.g. different tenants) to different ETS tables, without partitioning metrics within a table.
v0idpwn
approved these changes
Apr 17, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Peep storage backend that reduces ETS write contention by routing metrics into multiple ETS tables based on an optional tag value, and wires it into PromEx.
Changes:
- Introduce
Realtime.Monitoring.Peep.PartitionedTables(N ETS tables, optional:routing_tag-based routing). - Switch PromEx’s Peep storage to
PartitionedTableswithrouting_tag: :tenant. - Add unit tests for routing/pruning behavior and relax timing in
MetricsPushertests to reduce flakiness.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
lib/realtime/monitoring/peep/partitioned_tables.ex |
New Peep storage implementation backed by multiple ETS tables with optional tag-based routing. |
lib/realtime/monitoring/prom_ex.ex |
Uses PartitionedTables as the PromEx Peep storage and configures tenant-based routing. |
test/realtime/monitoring/peep/partitioned_tables_test.exs |
Adds coverage for cross-table aggregation, routing fallback, and targeted pruning. |
test/realtime/metrics_pusher_test.exs |
Increases assert_receive timeouts to reduce test flakiness. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🎉 This PR is included in version 2.86.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Peep.Storage implementation using N ETS tables with optional tag-based routing.
Each metric write is routed to a specific table based on a
:routing_tagoption. If the routing tag is present in the metric's tags,:erlang.phash2/2is used to select the table. Otherwise, the first table is used.This reduces lock contention by routing different tag values (e.g. different tenants) to different ETS tables, without partitioning metrics within a table.
If a metric does not have a routing_tag to route we just put the on the first table. This way we never have a metric/tag combination in more than 1 table simplifying most operations.