Add HTTP metrics tag providers#1145
Open
n0tl3ss wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an extension point to contribute request-specific tags to Micronaut’s built-in HTTP client/server Micrometer timers, and updates docs/tests to demonstrate and validate the behavior.
Changes:
- Introduce
HttpMetricsTagContributor+HttpMetricContextAPI for deriving additional tags from request/response/exception context. - Thread
HttpRequestthrough metrics recording (WebMetricsHelper) and wire contributors into client/server metrics filters (ordered execution). - Document the new API and add a Spock test validating custom tags on both client and server meters.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/main/docs/guide/metricsConcepts.adoc | Documents the new HttpMetricsTagContributor extension point with an example include. |
| micrometer-core/src/test/groovy/io/micronaut/docs/HttpMetricsTagContributorExample.java | Adds a docs example bean that contributes a tenant tag from request headers. |
| micrometer-core/src/test/groovy/io/micronaut/configuration/metrics/binder/web/HttpMetricsSpec.groovy | Adds an integration test verifying contributor-provided tags appear on both client and server timers. |
| micrometer-core/src/main/java/io/micronaut/configuration/metrics/binder/web/WebMetricsHelper.java | Passes request context into metric recording and appends contributor tags to the built-in tag set. |
| micrometer-core/src/main/java/io/micronaut/configuration/metrics/binder/web/ServerMetricsFilter.java | Injects + orders tag contributors and passes them into WebMetricsHelper for server metrics. |
| micrometer-core/src/main/java/io/micronaut/configuration/metrics/binder/web/HttpMetricsTagContributor.java | New public extension point interface for contributing tags. |
| micrometer-core/src/main/java/io/micronaut/configuration/metrics/binder/web/HttpMetricContext.java | New context record carrying request/response/throwable and resolved metric attributes. |
| micrometer-core/src/main/java/io/micronaut/configuration/metrics/binder/web/ClientMetricsFilter.java | Injects + orders tag contributors and passes them into WebMetricsHelper for client metrics. |
Co-Authored-By: Codex with GPT-5 <codex@openai.com>
n0tl3ss
force-pushed
the
nmikic/issue-779-http-metrics-tag-contributor
branch
from
April 27, 2026 22:43
9d86e3a to
de0a486
Compare
|
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.



Summary
HttpMetricsTagProviderextension point for HTTP client and server metricsTest
Resolves #779