Skip to content

Health contributor exclusion rules aren't applied to child contributors #29251

Closed

Description

@philsttr

Excluding a composite health contributor by the composite name no longer works in spring boot 2.6. It worked previously in spring boot 2.5.

Potentially caused by #23027

Here is an example application, with a failing unit test... health-group-composite-test.zip

The excludefoo_endpoint_should_not_contain_foo_indicators test fails with spring-boot 2.6.2. If you change the application to use spring boot 2.5.8, the test will pass.

The application defines a composite health contributor named foo as follows:

	@Bean
	CompositeHealthContributor fooHealthContributor() {
		return CompositeHealthContributor.fromMap(Map.<String, HealthIndicator>of(
				"foo-1", () -> Health.up().build(),
				"foo-2", () -> Health.up().build()
				));
	}

And then creates a health group named exclude-foo that excludes that contributor:

management:
  endpoint:
    health:
      show-details: always
      group:
        exclude-foo:
          include: "*"
          exclude: foo
          show-details: always

With spring boot 2.5.8, the exclude-foo group endpoint does not show the foo indicators (as expected)...

$ http :8080/actuator/health/exclude-foo
HTTP/1.1 200 OK
Content-Length: 169
Content-Type: application/vnd.spring-boot.actuator.v3+json

{
    "components": {
        "diskSpace": {
            "details": {
                "exists": true,
                "free": 644861575168,
                "threshold": 10485760,
                "total": 989547458560
            },
            "status": "UP"
        },
        "ping": {
            "status": "UP"
        }
    },
    "status": "UP"
}

With spring boot 2.6.2, the exclude-foo group endpoint shows the foo indicators (unexpected)...

$ http :8080/actuator/health/exclude-foo 
HTTP/1.1 200 OK
Content-Length: 254
Content-Type: application/vnd.spring-boot.actuator.v3+json

{
    "components": {
        "diskSpace": {
            "details": {
                "exists": true,
                "free": 644852699136,
                "threshold": 10485760,
                "total": 989547458560
            },
            "status": "UP"
        },
        "foo": {
            "components": {
                "foo-1": {
                    "status": "UP"
                },
                "foo-2": {
                    "status": "UP"
                }
            },
            "status": "UP"
        },
        "ping": {
            "status": "UP"
        }
    },
    "status": "UP"
}

Activity

  1. added and removed
    status: waiting-for-triageAn issue that has not yet been triaged. Contributions will not be accepted.
    on Jan 4, 2022
  2. modified the milestones: 2.6.3, 2.6.x on Jan 4, 2022
  3. self-assigned this
    on Jan 4, 2022
  4. added
    type: regressionA regression from a previous release
    and removed on Jan 4, 2022
  5. changed the title [-]Unable to exclude composite health contributor by the composite name[/-] on Jan 4, 2022
  6. modified the milestones: 2.6.x, 2.6.3 on Jan 4, 2022
  7. added a commit that references this issue on Jan 4, 2022
    8e583f6
  8. philwebb commented on Jan 4, 2022

    @philwebb
    Member

    Thanks for the sample @philsttr. I've hopefully fixed this for 2.6.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions