Closed YLombardi closed 8 years ago
Are you referring to the Spring Boot Actuator /metrics
endpoint? If so, I believe this is a Spring Boot Actuator enhancement request and it has been discussed before. Please check the issues there.
Yes I'm referring to this endpoint. I found a solution by creating a new endpoint that call the MetricsEndpoint and sort the result.
@Component
public class CustomMetricsEndpoint extends AbstractEndpoint<Map<String, Object>> {
private MetricsEndpoint metricsEndpoint;
@Autowired
public CustomMetricsEndpoint(MetricsEndpoint metricsEndpoint) {
super("custommetrics");
this.metricsEndpoint = metricsEndpoint;
}
public Map<String, Object> invoke() {
SortedMap<String, Object> metricsMap =
new TreeMap<String, Object>(this.metricsEndpoint.invoke());
return metricsMap;
}
}
I'm not familiar with the Spring Boot Actuator /metrics endpoint, but it would appear @shakuzen is correct.
Hi.
I just begin to use metrics-spring and follow "basic usage" tutorial (add the dependency and create a MetricsConfigurationClass). I add @Timed(name = "methodX", absolute = true) on some methods.
After starting my application, I use the metrics endpoint to read the metrics and I see that each time I refresh, the custom metrics are in a different order.
Is it possible to sort the metrics by keys ?