Repository navigation
refactor(metrics): Rewrite metric exporter - #309
Merged
Merged
Conversation
This was
linked to
issues
Sep 26, 2026
ketiltrout
force-pushed
the
redo_prom_client
branch
from
September 26, 2026 05:56
4439678 to
c7c93ad
Compare
This is a complete rewrite of the metric exporter to fix problems with the old implementation, the chief one being it didn't work with any `prometheus_client >= 0.8` (see #198). The old metrics exporter was a separate thread-based HTTP server created by the qworker within the request_forwarder's context and listening on a second port. The new way it's done now is the things that used to directly update metrics, now push these updates into redis and there's a separate Sanic worker (the metric aggregator) that pops these updates out of redis and keeps the metrics up-to-date. Access to the metrics is through a `/metrics` route in the Sanic server now (no secondary web server used) and this route dispatches a request to the aggregator which responds with the rendered metrics, which are then passed back to the client. Because there's no separate prom-client HTTP server anymore, the `metrics_port` config value is no longer used. cocod will emit a warning about that key being ignored if encountered during start-up.
ketiltrout
force-pushed
the
redo_prom_client
branch
from
September 26, 2026 06:00
c7c93ad to
c9068a6
Compare
ketiltrout
added this pull request to stack #311
September 26, 2026 06:57
ljgray
approved these changes
Sep 28, 2026
This was referenced Sep 28, 2026
ketiltrout
added a commit
that referenced
this pull request
Sep 28, 2026
This is the last of the old tests that needed recovery. It was waiting on the prometheus client fix. This also moves the creation of the queue update script down to where it's first used. If coco isn't using a limited queue, it won't be used at all. Requires #309 because the test checks the metrics. Closes #252
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.
This is a complete rewrite of the metric exporter to fix problems with the old implementation, the chief one being it didn't work with any
prometheus_client >= 0.8(see #198).The old metrics exporter was a separate thread-based HTTP server created by the qworker within the request_forwarder's context and listening on a second port.
The new way it's done now is the things that used to directly update metrics, now push these updates into redis and there's a separate Sanic worker (the metric aggregator) that pops these updates out of redis and keeps the metrics up-to-date.
Access to the metrics is through a
/metricsroute in the Sanic server now (no secondary web server used) and this route dispatches a request to the aggregator which responds with the rendered metrics, which are then passed back to the client.Because there's no separate prom-client HTTP server anymore, the
metrics_portconfig value is no longer used. cocod will emit a warning about that key being ignored if encountered during start-up.There are no changes to the metrics provided by cocod.
Closes #198
Closes #204