Overview
Helix Spring Boot webservice that shows how the built-in HTTP metrics filter captures standard request metrics and how
those metrics can be inspected through the actuator metrics endpoint.
Run this example from the shared examples build:
Run
Run this example from the shared examples build
./gradlew -p examples runExample -Pexample=rest-api/metrics --init-script "$(pwd)/helix.init.gradle"
What It Shows
- the Helix API starter baseline
- enabling the management
metricsendpoint on a dedicated management port - the built-in Helix HTTP metrics filter
- standard metrics such as
http.request.count,http.request.time,http.request.success.count, andhttp.request.error.count - scoping the filter to selected application routes with
helix.filter.httpmetrics.url-patterns - viewing metric values and tags through the management metrics actuator
Endpoints
GET /v1/metrics/orders/summaryGET /v1/metrics/orders/failureGET /metricsGET /metrics/http.request.countGET /metrics/http.request.timeGET /metrics/http.request.success.countGET /metrics/http.request.error.countGET /livenessGET /health
Example success response
{
"request_id": "generated-by-helix",
"status": "SUCCESS",
"timestamp": "2026-03-15T12:34:56+0000",
"data": {
"applicationEndpoint": "http://localhost:8080/v1/metrics/orders/summary",
"metricsEndpoint": "http://localhost:8081/metrics/http.request.count?tag=uri:/v1/metrics/orders/summary",
"description": "Call the application endpoint, then inspect the matching metric on the management port."
}
}
Example management response
{
"name": "http.request.count",
"measurements": [
{
"statistic": "COUNT",
"value": 2.0
}
],
"availableTags": [
{
"tag": "uri",
"values": [
"/v1/metrics/orders/summary",
"/v1/metrics/orders/failure"
]
}
]
}
Development
Building the Application
Run the following command to build the service:
Command
Building the Application
./gradlew clean build
Testing the Application
Run the following command to run the service tests:
Command
Testing the Application
./gradlew test
./gradlew integration
Trying the API
Run the service:
Then try:
The application endpoints on port 8080 generate the standard Helix HTTP metrics. The management metrics endpoint on port 8081 then lets you inspect those meters by name and narrow them with tags such as uri, type, and status.
Command
Trying the API
./gradlew bootRun
Command
Trying the API
curl http://localhost:8080/v1/metrics/orders/summary
curl http://localhost:8080/v1/metrics/orders/failure
curl 'http://localhost:8081/metrics/http.request.count?tag=uri:/v1/metrics/orders/summary'
curl 'http://localhost:8081/metrics/http.request.success.count?tag=uri:/v1/metrics/orders/summary'
curl 'http://localhost:8081/metrics/http.request.error.count?tag=uri:/v1/metrics/orders/failure&tag=type:server&tag=status:503'