From StackOverflow.

I'm not convinced we should sort on the server side because the links endpoint is quite likely to be consumed by applications such as Spring Boot admin rather than human consumption. However, it might be nicer to read if someone was looking at it in the browser. Looking to see what the rest of the team thought about cost of sorting vs benefits.

Comment From: manueljordan

Thanks for the reply on SO. I understand the point about the client side.

So if exists a Plugin or GUI that let sort the /actuator links values, perhaps it would be added on the Reference Documentation in some specific section indicating this situation through a special note.

Because in many tutorials and for quick development purposes the web browser is used directly, so it would be nice add sorting support through the server and based to return the data through request parameters to indicate if should be asc or desc. I mean /actuator?sort=desc

I know it is not critical. But it is a simple but valuable feature

BTW I don't remember if in JMX the points appears unsorted too

Thanks for your understanding.

Comment From: wilkinsona

See https://github.com/spring-projects/spring-boot/issues/19934 and the issues to which it links for some reasons why we should or should not sort a response on the server side. /actuator returns the links in a map which means that a client is free to sort them automatically and many browser plugins and command line tools already do so. For example, here's the response when using HTTPie:

HTTP/1.1 200 
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Connection: keep-alive
Content-Type: application/vnd.spring-boot.actuator.v3+json
Date: Fri, 15 Jan 2021 08:29:43 GMT
Expires: 0
Keep-Alive: timeout=60
Pragma: no-cache
Set-Cookie: JSESSIONID=D2574FA9F0E6CFF69E4AFAAF6117DBAC; Path=/; HttpOnly
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block

{
    "_links": {
        "anotherlegacy": {
            "href": "http://localhost:8080/actuator/anotherlegacy",
            "templated": false
        },
        "beans": {
            "href": "http://localhost:8080/actuator/beans",
            "templated": false
        },
        "caches": {
            "href": "http://localhost:8080/actuator/caches",
            "templated": false
        },
        "caches-cache": {
            "href": "http://localhost:8080/actuator/caches/{cache}",
            "templated": true
        },
        "conditions": {
            "href": "http://localhost:8080/actuator/conditions",
            "templated": false
        },
        "configprops": {
            "href": "http://localhost:8080/actuator/configprops",
            "templated": false
        },
        "env": {
            "href": "http://localhost:8080/actuator/env",
            "templated": false
        },
        "env-toMatch": {
            "href": "http://localhost:8080/actuator/env/{toMatch}",
            "templated": true
        },
        "health": {
            "href": "http://localhost:8080/actuator/health",
            "templated": false
        },
        "health-path": {
            "href": "http://localhost:8080/actuator/health/{*path}",
            "templated": true
        },
        "heapdump": {
            "href": "http://localhost:8080/actuator/heapdump",
            "templated": false
        },
        "info": {
            "href": "http://localhost:8080/actuator/info",
            "templated": false
        },
        "legacy": {
            "href": "http://localhost:8080/actuator/legacy",
            "templated": false
        },
        "loggers": {
            "href": "http://localhost:8080/actuator/loggers",
            "templated": false
        },
        "loggers-name": {
            "href": "http://localhost:8080/actuator/loggers/{name}",
            "templated": true
        },
        "mappings": {
            "href": "http://localhost:8080/actuator/mappings",
            "templated": false
        },
        "metrics": {
            "href": "http://localhost:8080/actuator/metrics",
            "templated": false
        },
        "metrics-requiredMetricName": {
            "href": "http://localhost:8080/actuator/metrics/{requiredMetricName}",
            "templated": true
        },
        "scheduledtasks": {
            "href": "http://localhost:8080/actuator/scheduledtasks",
            "templated": false
        },
        "self": {
            "href": "http://localhost:8080/actuator",
            "templated": false
        },
        "shutdown": {
            "href": "http://localhost:8080/actuator/shutdown",
            "templated": false
        },
        "threaddump": {
            "href": "http://localhost:8080/actuator/threaddump",
            "templated": false
        }
    }
}

Comment From: manueljordan

I see now.

Being polite, if the current Reference Documentation for Actuator can include the commands to return the metrics sorted, it for the most used tools such as: curl, postman, HTTPie, etc would be nice. Not sure if JSONView plugin for chrome supports sorting, and the equivalent plugin for FF, well I use Chrome to use in peace other plugin named Live Reload, used by DevTools

Comment From: wilkinsona

Documenting other tools is out of scope of Spring Boot's reference documentation, particularly when there are so many to choose from each with different defaults and defaults that may change over time. IMO, a better option is to select a tool that meets your needs. For example, in the HTTPie documentation you can learn that it sorts JSON keys by default and provides options to customize this behaviour. Some searching has also taught me that the Chrome JSON Viewer plugin has an "option to sort json by keys".

Comment From: manueljordan

Ok, I understand. For guide/indications purposes for other developers, perhaps would be nice indicate that the Client side should do the sorting approach. I think it would be enough.