fix: change MetricsPusher to also send tenant metrics#1759
Open
fix: change MetricsPusher to also send tenant metrics#1759
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Updates Realtime.MetricsPusher to push both global and tenant PromEx metrics on each interval, running each aggregation/push in its own supervised Task so memory can be reclaimed when the task exits.
Changes:
- Push global metrics (
Realtime.PromEx.get_global_metrics/0) and tenant metrics (Realtime.TenantPromEx.get_metrics/0) concurrently viaTask.Supervisor.async_nolink/2. - Add timeout/exit handling for metrics push tasks and label global vs tenant failures in logs.
- Update
MetricsPusherTestexpectations to account for two push requests per interval and seed tenant telemetry.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| lib/realtime/metrics_pusher.ex | Runs global + tenant metrics pushes in separate supervised tasks and adds labeled logging/error handling. |
| test/realtime/metrics_pusher_test.exs | Updates tests to expect two HTTP pushes and seeds tenant telemetry for tenant-metric generation. |
Comments suppressed due to low confidence (1)
test/realtime/metrics_pusher_test.exs:104
- This test is named "sends request body untouched when compress=false", but it no longer asserts anything about the request body (only headers). Please assert that the raw body contains expected plaintext metrics (and is not gzip-compressed) for both requests so the test actually validates the non-compression behavior.
Req.Test.expect(MetricsPusher, 2, fn conn ->
assert Conn.get_req_header(conn, "content-encoding") == []
assert Conn.get_req_header(conn, "content-type") == ["text/plain"]
send(parent, :req_called)
Req.Test.text(conn, "")
end)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
27f15fb to
f53439a
Compare
Also use Tasks to ensure that they drop the used memory after aggregating such metrics
f53439a to
866fd7c
Compare
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?
Also use Tasks to ensure that they drop the used memory after aggregating such metrics