spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.32k stars 40.71k forks source link

Enhanced Observability #25476

Open jonatan-ivanov opened 3 years ago

jonatan-ivanov commented 3 years ago

This is a placeholder issue to group smaller tasks together to provide better Observability support for Spring Boot users.

Info enhancements

See:

Health enhancements

Spring Security enhancements

The list is still in progress and very likely to evolve in the near future.

dsyer commented 1 year ago

The activeProfiles is already exposed in the /env endpoint.

jonatan-ivanov commented 1 year ago

Good point, today I was implementing it and I realized that if I don't set the active profiles property but set spring.profiles.default, then environment.getActiveProfiles() will be empty and the profle I set for default will be used. I think on the info endpoint it would be more useful to return the "effectively used profiles" instead of the value of environment.getActiveProfiles(). Something like this I guess:

String[] getEffectiveProfiles() {
    return ObjectUtils.isEmpty(environment.getActiveProfiles()) ? environment.getDefaultProfiles() : environment.getActiveProfiles();
}
dsyer commented 1 year ago

Uptime is already a metric as well - I guess it really belongs there because you don't expect info to change over time.

jonatan-ivanov commented 1 year ago

I think using data that can change over time should be ok on the info endpoint, e.g.: current time (to detect clock skew issues), uptime (to see if the app was restarted or not), even the cpu count can change over time (because of cgroups).

I think the same about data that we have metrics for, e.g.: jvm version info. I think they can be used in different use-cases and the user should decide if they want one or the other or both.