1

I have a Spring boot application that it executes several parallel requests, of course, using RestTemplate class. I configured Spring actuator,to see the Http Trace. management.endpoints.web.exposure.include=httptrace

When I execute: http://localhost:8080/actuator/httptrace I see information but related to the request I am doing to my Spring Mvc exposed controllers, but I don't see any info related to the request I am doing internally.

So how can I achieve that? Could you show me some example? Thanks in advance folks!

Romil Patel
  • 12,879
  • 7
  • 47
  • 76
Al Xx
  • 89
  • 3
  • 10

1 Answers1

1

You can use Spring Boot /actuator/metrics/http.server.requests to get all endPoints which are executed with their count, exception, outcome, status, total time, etc as follow.

If you want to see details for particular endPoint then you can do it by calling request as follow

localhost:8889/actuator/metrics/http.server.requests?tag=uri:<endPoint>
localhost:8889/actuator/metrics/http.server.requests?tag=uri:/user/asset/getAllAssets
localhost:8889/actuator/metrics/http.server.requests?tag=uri:/user/asset/getAllAssets&tag=status:200
  • You will get COUNT as how many times particular endPoint has been called
  • You will get COUNT as how many times particular endPoint has been called with a particular Status
  • To get the average time to execute endPoint you can do TOTAL_TIME/COUNT for particular endPoint as well as for the whole application

More Details are Here

localhost:8889/actuator/metrics/http.server.requests

{
    "name": "http.server.requests",
    "description": null,
    "baseUnit": "seconds",
    "measurements": [
        {
            "statistic": "COUNT",
            "value": 3
        },
        {
            "statistic": "TOTAL_TIME",
            "value": 0.21817219999999998
        },
        {
            "statistic": "MAX",
            "value": 0.1379249
        }
    ],
    "availableTags": [
        {
            "tag": "exception",
            "values": [
                "MethodArgumentTypeMismatchException",
                "None"
            ]
        },
        {
            "tag": "method",
            "values": [
                "GET"
            ]
        },
        {
            "tag": "uri",
            "values": [
                "/{id}.*",
                "/user/asset/getAsset/{assetId}",
                "/user/asset/getAllAssets"
            ]
        },
        {
            "tag": "outcome",
            "values": [
                "CLIENT_ERROR",
                "SUCCESS"
            ]
        },
        {
            "tag": "status",
            "values": [
                "400",
                "404",
                "200"
            ]
        }
    ]
}
Romil Patel
  • 12,879
  • 7
  • 47
  • 76
  • I think i dont need that,because i wont be loggin my internal request which i am doing inside my endpoints.In other words,i dont need the metrics of my Endpoints,i need my metrics/trace related to each request i am doint inside my application.Thanks. – Al Xx Jul 16 '19 at 17:16
  • Hello @AlXx can you please elaborate more with your expected output by adding it in question – Romil Patel Jul 25 '19 at 04:32