feat(metrics): support Basic authentication for Prometheus endpoint - #3579
Open
BackendArchitectX wants to merge 7 commits into
Open
feat(metrics): support Basic authentication for Prometheus endpoint#3579BackendArchitectX wants to merge 7 commits into
BackendArchitectX wants to merge 7 commits into
Conversation
Signed-off-by: BackendArchitectX <96111851+BackendArchitectX@users.noreply.github.com>
BackendArchitectX
requested review from
1sonofqiu,
Gezi-lzq and
superhx
as code owners
September 4, 2026 17:00
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.
Fixes #3573
Why
The built-in Prometheus endpoint currently allows any client with network access to scrape /metrics. This change adds optional in-process HTTP Basic authentication while preserving the existing unauthenticated behavior by default.
What
Configuration
s3.telemetry.metrics.prometheus.auth.type=none|basic
s3.telemetry.metrics.prometheus.auth.username=
s3.telemetry.metrics.prometheus.auth.password=
The default is none, so existing deployments remain unchanged. When basic is enabled, missing or invalid credentials return HTTP 401 and valid credentials can scrape metrics successfully.
OpenTelemetry compatibility
Upgrades OpenTelemetry SDK to 1.50.0, SDK/Prometheus alpha to 1.50.0-alpha, and instrumentation alpha to 2.16.0-alpha. Compatibility updates preserve existing metric cardinality, local JMX, GC metric shape, and Prometheus immutable-data behavior.
Security considerations
Basic authentication does not encrypt transport. Deployments crossing untrusted networks should continue to provide TLS through an ingress, reverse proxy, sidecar, or equivalent network control. Credential rotation is restart-based in this initial implementation.
Testing
Validated locally with :automq-metrics:test, :automq-metrics:check, AutoMQConfigTest, :core:checkstyleMain, :core:spotlessJavaCheck, jar -x test, rat, and git diff --check upstream/main...HEAD.
Coverage includes default unauthenticated scraping, missing credentials, wrong username/password, malformed Base64, wrong auth scheme, successful authenticated scraping, /metrics/... protection, public root/health endpoints, config validation, and exporter shutdown/port release.
Committer Checklist (excluded from commit message)