apache / apache/grails-core

Percentile histograms of springBoot Actuator Metrics does not give the right URI

Open
#11,838 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

The percentile metrics result of SpringBoot Actuator integrated with Grails 4 is unexpected, and all the URI of the request is mapped to root.

For SpringBoot Actuator, the metrics is just the real request.

A similar description can be found in the following link:
https://stackoverflow.com/questions/66039125/obtaining-usable-grails-url-for-micrometer-metrics

### Task List

- [x] Steps to reproduce provided
- [ ] Stacktrace (if present) provided
- [x] Example that reproduces the problem uploaded to Github
- [x] Full description of the issue provided (see below)

### Steps to Reproduce
1. using Grails 4.0.10, run `grails create-app grailsActuatorTest -profile rest-api` to create a project
2. add the following configuration to `grails-app/conf/application.yml`
```yaml
management:
endpoint:
metrics:
enabled: true
endpoints:
enabled-by-default: false
web:
exposure:
include:
- metrics
metrics:
distribution:
percentiles:
http:
server:
requests: 0.80,0.90,0.99
```
3. add a new route in UrlMapping with the corresponding controller logic, here is AccountController
4. start the application, and run the following request
```shell
curl http://localhost:9090/account?name=customer
curl http://localhost:9090/account?name=boss

curl http://localhost:9090/actuator/metrics/http.server.requests.percentile

# it is better to format the result with jq
curl http://localhost:9090/actuator/metrics/http.server.requests.percentile | jq .

```

### Expected Behaviour
The `values` of `"tag": "uri"` should include the request of `/account` .

### Actual Behaviour
The unexpected `root` is in the `values` list . But the `/account` is disappeared.

```json
{
"tag": "uri",
"values": [
"/actuator/metrics/{requiredMetricName}",
"/actuator/metrics/",
"root"
]
},
```

### Environment Information

- **Operating System**: macOS 11
- **Grails Version:** 4.0.10
- **JDK Version:** java "1.8.0_211"
- **Container Version (If Applicable):** NA

### Example Application

https://github.com/shengleee/grailsActuatorTest

Contributor guide

Open the contributing guide

Research direction

Start with the application.yml metrics configuration, UrlMapping, AccountController, and the linked grailsActuatorTest example; reproduce the percentile output through the Actuator metrics endpoint. Trace how the /account request is recorded and determine why its URI becomes root. Done means the metrics response includes /account instead of root.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, spring-boot
Domain
backend, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.