feat: add prometheus endpoint#1008
Open
pauliyobo wants to merge 8 commits into
Open
Conversation
kvch
reviewed
Jul 23, 2026
|
|
||
| if s.isPrometheusEnabled() { | ||
| endpoint := DefaultPrometheusEndpoint | ||
| if promEndpoint := s.metricsConfig.Prometheus.Endpoint; promEndpoint != "" { |
Collaborator
There was a problem hiding this comment.
Please validate the endpoint format.
kvch
reviewed
Jul 23, 2026
|
|
||
| srv := health.NewServer(*cfg, opts...) | ||
| var metricsCfg *otel.MetricsConfig | ||
| if instrumentationCfg.Metrics != nil { |
Collaborator
There was a problem hiding this comment.
It seems to me that if the health server is not enabled, but prometheus is enabled, the endpoint is not going to work.
Author
There was a problem hiding this comment.
Yeah, that's correct. This is because of the dependency the metrics endpoint has on the health server. this was also documented. What would be preferred in this case?
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.
Description
This PR allows pgstream to expose a configurable Prometheus endpoint, served from the existing health server, so metrics can be scraped directly via the OTel Prometheus exporter without requiring an OTLP collector.
Related Issue(s)
closes #903
Type of Change
Please select the relevant option(s):
Changes Made
instrumentation.metrics.prometheusconfig (YAML and env vars) to enable/configure a Prometheus scrape endpoint./metrics, returns 404 when disabled).Testing
Checklist
Additional Notes
I have made the endpoint configurable as well. Is that fine, or should I leave /metrics?