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

9.10.0: Always initialise GovukPrometheusExporter. #361

Merged
merged 1 commit into from
Mar 26, 2024

Conversation

sengi
Copy link
Contributor

@sengi sengi commented Mar 26, 2024

Some client apps have started to assume that the Prometheus "exporter" process (i.e. the process that aggregates counters in multi-process apps) is always available, including in tests.

Now that we handle the case where the /metrics port is already taken, there's really no reason not to initialise GovukPrometheusExporter.

Remove the confusing heuristics in GovukPrometheusExporter.should_configure and just always attempt to initialise unless we're running under rails console. When the init fails, we just print a warning and continue anyway, so this should be a net win for robustness.

If we find edge cases where this still needs to be configurable then I propose we address those if/when we find and understand them. I expect we won't need to, though.

Kudos to @leenagupte for reporting the issue.

Copy link
Contributor

@KludgeKML KludgeKML left a comment

Choose a reason for hiding this comment

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

LGTM, nice simplification.

@sengi
Copy link
Contributor Author

sengi commented Mar 26, 2024

This should eliminate the need for the workaround in alphagov/finder-frontend#3318 and alphagov/search-api-v2#246 (hopefully without introducing any other significant issues 😅)

Some client apps have started to assume that the Prometheus "exporter"
process (i.e. the process that aggregates counters in multi-process
apps) is always available, including in tests.

Now that we handle the case where the `/metrics` port is already taken,
there's really no reason not to initialise GovukPrometheusExporter.

Remove the confusing heuristics in
`GovukPrometheusExporter.should_configure` and just always attempt to
initialise unless we're running under `rails console`. When the init
fails, we just print a warning and continue anyway, so this should be a
net win for robustness.

If we find edge cases where this still needs to be configurable then I
propose we address those if/when we find and understand them. I expect
we won't need to, though.
@sengi sengi force-pushed the sengi/govuk-prom-defaults branch from 2397073 to 3c6dd35 Compare March 26, 2024 15:06
@sengi
Copy link
Contributor Author

sengi commented Mar 26, 2024

Realised I'd missed out the words "environment variable" in the changelog entry 🙃 (force-pushed to update)

@sengi sengi merged commit 01e485e into main Mar 26, 2024
12 checks passed
@sengi sengi deleted the sengi/govuk-prom-defaults branch March 26, 2024 15:08
sengi added a commit to alphagov/govuk-helm-charts that referenced this pull request Mar 26, 2024
`GOVUK_PROMETHEUS_EXPORTER` was removed in
alphagov/govuk_app_config#361, so once that
lands in all its consumer apps we can remove it from the config.
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