Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting cache time-to-live for the health endpoint has no effect #28882

Closed
maxxedev opened this issue Dec 1, 2021 · 1 comment
Closed

Setting cache time-to-live for the health endpoint has no effect #28882

maxxedev opened this issue Dec 1, 2021 · 1 comment
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@maxxedev
Copy link

maxxedev commented Dec 1, 2021

In spring-boot 2.6.0 and 2.6.1, it appears that cache.time-to-live for actuator endpoints are broken.

Read operations are not cached even if configured to be so.

Example to reproduce:

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        System.setProperty("management.endpoint.health.cache.time-to-live", "10s");
        System.setProperty("management.endpoint.health.show-details", "ALWAYS");
        SpringApplication.run(DemoApplication.class, args);
    }

    @Bean
    HealthIndicator dateTimeHealthIndator() {
        return () -> Health.up()
                           .withDetail("dateTime", OffsetDateTime.now())
                           .build();
    }
}


$ date ; curl -s localhost:8080/actuator/health | jq .components.dateTimeHealthIndator
Tue Nov 30 15:48:55 PST 2021
{
  "status": "UP",
  "details": {
    "dateTime": "2021-11-30T15:48:55.284381-08:00"
  }
}

$ date ; curl -s localhost:8080/actuator/health | jq .components.dateTimeHealthIndator
Tue Nov 30 15:48:59 PST 2021
{
  "status": "UP",
  "details": {
    "dateTime": "2021-11-30T15:48:59.120667-08:00"
  }
}

According to @wilkinsona , this is likely a regression introduced by changes in https://github.com/spring-projects/spring-boot/issues/25471

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 1, 2021
@wilkinsona
Copy link
Member

Thanks for raising this, @maxxedev. AFAIK, it's just the health endpoint that's affected.

@wilkinsona wilkinsona changed the title cache time-to-live for actutator endpoints broken Setting cache time-to-live for the health endpoint has no effect Dec 1, 2021
@wilkinsona wilkinsona added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 1, 2021
@wilkinsona wilkinsona added this to the 2.6.x milestone Dec 1, 2021
@mbhave mbhave self-assigned this Dec 16, 2021
@mbhave mbhave closed this as completed in 4cc8012 Dec 18, 2021
@mbhave mbhave modified the milestones: 2.6.x, 2.6.2 Dec 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

4 participants