Skip to content

Add common tags via configuration#1160

Open
n0tl3ss wants to merge 3 commits into
6.0.xfrom
nmikic/issue-1050-common-tags-config
Open

Add common tags via configuration#1160
n0tl3ss wants to merge 3 commits into
6.0.xfrom
nmikic/issue-1050-common-tags-config

Conversation

@n0tl3ss

@n0tl3ss n0tl3ss commented Apr 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Support common Micrometer tags from nested micronaut.metrics.tags.* configuration.
  • Add micronaut.metrics.common-tags.* as a clearer alias for common tag configuration.
  • Let micronaut.metrics.common-tags.* override legacy micronaut.metrics.tags.* values for duplicate keys and ignore null common tag values.
  • Cover dotted and map-form configuration for both common tag prefixes in endpoint and configurer tests.

Verification

  • ./gradlew :micronaut-micrometer-core:test --rerun-tasks --tests 'io.micronaut.configuration.metrics.common.tags.CommonTagsConfigurerSpec' --tests 'io.micronaut.configuration.metrics.management.endpoint.MetricsEndpointSpec' --tests 'io.micronaut.configuration.metrics.micrometer.MeterRegistryConfigurerOrderSpec'

Resolves #1050

Co-Authored-By: Codex with GPT-5 <codex@openai.com>
@n0tl3ss n0tl3ss added the type: enhancement New feature or request label Apr 27, 2026
@n0tl3ss n0tl3ss self-assigned this Apr 27, 2026
Co-Authored-By: Codex with GPT-5 <codex@openai.com>
@n0tl3ss
n0tl3ss requested a review from Copilot April 27, 2026 21:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for configuring Micrometer common tags via a clearer micronaut.metrics.common-tags.* alias while retaining compatibility with the legacy micronaut.metrics.tags.* prefix.

Changes:

  • Introduces micronaut.metrics.common-tags.* as an alias for common tag configuration, while still supporting micronaut.metrics.tags.*.
  • Updates common tag wiring to be conditionally enabled when either prefix is configured, and reads tags from both dotted and map-form configs.
  • Extends endpoint tests to cover both prefixes and both configuration styles.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/main/docs/guide/metricsConcepts.adoc Documents common tag configuration and the new alias prefix.
micrometer-core/src/test/groovy/io/micronaut/configuration/metrics/micrometer/MeterRegistryConfigurerOrderSpec.groovy Updates expectations now that the common-tags configurer is conditional.
micrometer-core/src/test/groovy/io/micronaut/configuration/metrics/management/endpoint/MetricsEndpointSpec.groovy Adds matrix coverage for dotted vs map config and both tag prefixes.
micrometer-core/src/main/java/io/micronaut/configuration/metrics/micrometer/MeterRegistryFactory.java Splits constants for legacy tags vs new common-tags prefix.
micrometer-core/src/main/java/io/micronaut/configuration/metrics/common/tags/CommonTagsConfigurer.java Reads tags from both prefixes using Environment and applies them as common tags.
micrometer-core/src/main/java/io/micronaut/configuration/metrics/common/tags/CommonTagsCondition.java Enables the configurer when either prefix is present (dotted or map form).

Co-Authored-By: Codex with GPT-5 <codex@openai.com>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement New feature or request

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Add common tags via configuration

3 participants