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

Micrometer URI templating does not apply for Forbidden requests #40305

Closed
oscarobr opened this issue Apr 26, 2024 · 5 comments · Fixed by #40308
Closed

Micrometer URI templating does not apply for Forbidden requests #40305

oscarobr opened this issue Apr 26, 2024 · 5 comments · Fixed by #40308
Assignees
Labels
Milestone

Comments

@oscarobr
Copy link

Describe the bug

In case a HTTP request ends up in 403 Forbidden, the Micrometer URI tag will not be templated, but include the full URI

there was a similar issue for 401 that was solved /issues/24938

Expected behavior

All reported metrics should have templated URI tags

Actual behavior

Requests that return 403 Forbidden create metrics that are not templated

How to Reproduce?

Reproducer can be found here:
https://github.com/oscarobr/micrometer-uri-template-bug

See the failing test case that verifies the issue
https://github.com/oscarobr/micrometer-uri-template-bug/blob/main/src/test/java/com/example/ExampleResourceTest.java

Output of uname -a or ver

Linux ThinkPad-T14s-Gen-2a 6.5.0-28-generic #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 4 14:39:20 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "21.0.2" 2024-01-16 LTS OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode, sharing)

Quarkus version or git rev

3.9.4

Build tool (ie. output of mvnw --version or gradlew --version)

------------------------------------------------------------ Gradle 8.6 ------------------------------------------------------------ Build time: 2024-02-02 16:47:16 UTC Revision: d55c486870a0dc6f6278f53d21381396d0741c6e Kotlin: 1.9.20 Groovy: 3.0.17 Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023 JVM: 21.0.2 (Eclipse Adoptium 21.0.2+13-LTS) OS: Linux 6.5.0-28-generic amd64

Additional information

No response

@oscarobr oscarobr added the kind/bug Something isn't working label Apr 26, 2024
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 26, 2024

/cc @brunobat (micrometer), @ebullient (micrometer), @geoand (kotlin)

@geoand
Copy link
Contributor

geoand commented Apr 26, 2024

Your sample is not using Quarkus REST (formelly known as RESTEasy Reactive). However even with it, #40308 is required to make the tests pass.

geoand added a commit to geoand/quarkus that referenced this issue Apr 29, 2024
@oscarobr
Copy link
Author

Thanks for the hint, I didn't realize that these dependencies had been migrated

geoand added a commit that referenced this issue Apr 29, 2024
Always populate metrics uri in presence of auth failures
@quarkus-bot quarkus-bot bot added this to the 3.11 - main milestone Apr 29, 2024
poldinik pushed a commit to poldinik/quarkus that referenced this issue Apr 29, 2024
@gsmet gsmet modified the milestones: 3.11 - main, 3.10.1 May 10, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue May 10, 2024
@imjuoy
Copy link

imjuoy commented Jul 26, 2024

What is the standard behavior here?
I have an application which uses Quarkus 3.10.0, and I see the below behavior for URI templating.

  1. For requests with 2xx response code, the URI in the metrics is templated.
  2. For requests resulting in a 400 Bad Request response code, the URI in the metrics is NOT templated.
  3. For requests resulting in a 409 Duplicate response code, the URI in the metrics is templated.
  4. For requests resulting in a 403 Unauthorized response code, the URI in the metrics is templated.

Is this expected? I see multiple bugs related to templating not working for different error code. What is the standard behavior out of the box for Quarkus version 3.10.0?

@geoand
Copy link
Contributor

geoand commented Jul 29, 2024

For requests resulting in a 400 Bad Request response code, the URI in the metrics is NOT templated.

I would say that this is probably a bug, do you have a sample project that shows this problem in action?

holly-cummins pushed a commit to holly-cummins/quarkus that referenced this issue Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants