Skip to content

Unrestricted Health check should be able to be cached #2630

Closed

Description

@ericdahl

If endpoints.health.sensitive is set to false, then the caching feature of the Health endpoint is bypassed due to this check in HealthMvcEndpoint:

if (isCacheStale(accessTime) || isSecure(principal) || isUnrestricted()) {
    this.lastAccess = accessTime;
    this.cached = this.delegate.invoke();
}

It would be nice to still be able to have the caching functionality even if the health endpoint is unrestricted. For example, if I have an intensive health check which is unrestricted, but running on a local IP or otherwise protected, I may still want to have the value be cached so that an overly zealous health check doesn't cause the service to degrade.

Activity

  1. added this to the 1.2.3 milestone on Mar 10, 2015
  2. added
    type: enhancement
    and removed
    type: enhancement
    on Mar 10, 2015
  3. self-assigned this
    on Mar 16, 2015
  4. wilkinsona commented on Mar 16, 2015

    @wilkinsona
    Member

    I have a fix for this issue here.

    @philwebb I'd welcome your thoughts on the fix. Specifically, I'm wondering if we might also want a property to force caching for secure access. If we do, or we think we might in the future, then a single, more generally named property could be preferable to one that controls caching for unrestricted access and one that controls caching for secure access. endpoints.health.always-cache, perhaps?

  5. philwebb commented on Mar 17, 2015

    @philwebb
    Member

    @wilkinsona We could consider just always caching results. The current logic is a little complex and I'm wondering if the time-to-live property alone is enough for most people. The docs already imply that caching occurs regardless of how the endpoint is accessed or if it is secured.

  6. wilkinsona commented on Mar 19, 2015

    @wilkinsona
    Member

    @philwebb Sold. The current logic made my head hurt a bit when I was working on this fix; simplifying it definitely sounds good to me.

  7. added a commit that references this issue on Mar 19, 2015
    c849a0a
  8. added 2 commits that reference this issue on Mar 20, 2015
    c40d9fc
    8b64eab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions