Conversation
This commit adds send_sync and send_json_sync to the shared exporter client so callers can wait for a metric socket write before exiting. Synchronous sends reuse serialization and coordinate socket access with the background sender. Connection and write errors propagate to the caller; successful writes do not imply collector acknowledgement.
tgxworld
added a commit
to discourse/discourse-prometheus
that referenced
this pull request
Sep 25, 2026
Use the synchronous client API proposed in discourse/prometheus_exporter#384. Remove explicit queue draining and Ruby Timeout. The draft remains dependent on an exporter release and a matching gem version update.
A continuously replenished async queue could keep a synchronous sender waiting indefinitely for the socket lock. This commit releases the lock and yields between messages so synchronous writes can proceed before the queue empties. Add a regression test for sustained async traffic. Constrain JSON below version 3 in older Rails test appraisals, whose JSON encoder still passes the removed quirks_mode option, so CI can verify the change.
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 commit adds
PrometheusExporter::Client#send_syncandPrometheusExporter::Client#send_json_syncso callers can finish writing a metric to the socket before their process exits. This lets the Prometheus plugin report Pitchfork worker timeouts through its existing client.Synchronous sends can proceed while asynchronous metrics remain queued and propagate connection or write errors. Successful return confirms the socket write completed, without waiting for collector acknowledgement.
Older Rails test appraisals use
jsonbelow version 3 because their encoders pass an option removed in that version.