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

Use consistent list of micrometer tags in web observation handler #13179

Merged
merged 2 commits into from
May 18, 2023

Conversation

dfrommi
Copy link
Contributor

@dfrommi dfrommi commented May 15, 2023

The tag spring.security.reached.filter.name is only set if a filter-name is available, otherwise the tag is omitted entirely. This leads to issues with metric-exporters that don't support dynamic tags, but rather expect tag-names of a metric to be always the same. The most prominent example is the Prometheus-exporter.

Instead of omitting the tag if no filer-name is set, a none-value is applied instead, making the tag-list consistent in all cases

@pivotal-cla
Copy link

@dfrommi Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 15, 2023
@pivotal-cla
Copy link

@dfrommi Thank you for signing the Contributor License Agreement!

Copy link
Contributor

@jzheaux jzheaux left a comment

Choose a reason for hiding this comment

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

Thanks, @dfrommi, for the PR! I've left some feedback inline.

@jzheaux jzheaux self-assigned this May 15, 2023
@jzheaux jzheaux added in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels May 15, 2023
@dfrommi dfrommi force-pushed the consistent-tag-list branch 3 times, most recently from 749c8ed to dce4e1c Compare May 16, 2023 15:54
@dfrommi
Copy link
Contributor Author

dfrommi commented May 16, 2023

@jzheaux Thanks for the test-example.

As requested, I've added the same change to the reactive class as well.
I've also extended the condition slightly to use the NONE_VALUE also for empty strings. I think this makes perfect sense and allowed me to test it by using an anonymous class.
For the null case, I'd need something that returns null for getClass().getSimpleName() and I couldn't find anything that does.

dfrommi and others added 2 commits May 17, 2023 14:12
The tag `spring.security.reached.filter.name` is only set if a
filter-name is available, otherwise the tag is omitted entirely. This
leads to issues with metric-exporters that don't support dynamic tags,
but rather expect tag-names of a metric to be always the same. The most
prominent example is the Prometheus-exporter.

Instead of omitting the tag if no filer-name is set, a none-value is
applied instead, making the tag-list consistent in all cases

Closes spring-projectsgh-13179
Use StringUtils#hasText

PR spring-projectsgh-13179
@jzheaux jzheaux changed the base branch from main to 6.0.x May 17, 2023 20:13
@jzheaux jzheaux merged commit 4c5bf3b into spring-projects:6.0.x May 18, 2023
1 check passed
jzheaux pushed a commit that referenced this pull request May 18, 2023
The tag `spring.security.reached.filter.name` is only set if a
filter-name is available, otherwise the tag is omitted entirely. This
leads to issues with metric-exporters that don't support dynamic tags,
but rather expect tag-names of a metric to be always the same. The most
prominent example is the Prometheus-exporter.

Instead of omitting the tag if no filer-name is set, a none-value is
applied instead, making the tag-list consistent in all cases

Closes gh-13179
@jzheaux
Copy link
Contributor

jzheaux commented May 18, 2023

Thanks, @dfrommi, for the PR! This is merged into 6.0.x and main and will go out in the next point release.

@jzheaux jzheaux added type: bug A general bug and removed type: enhancement A general enhancement labels May 18, 2023
@jzheaux jzheaux added this to the 6.0.4 milestone May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web An issue in web modules (web, webmvc) type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants