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

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

Closed
philsttr opened this issue Jan 4, 2022 · 1 comment
Closed
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@philsttr
Copy link

philsttr commented Jan 4, 2022

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"
}

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 4, 2022
@philwebb philwebb added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 4, 2022
@philwebb philwebb modified the milestones: 2.6.3, 2.6.x Jan 4, 2022
@philwebb philwebb self-assigned this Jan 4, 2022
@philwebb philwebb added type: regression A regression from a previous release and removed type: bug A general bug labels Jan 4, 2022
@philwebb philwebb changed the title Unable to exclude composite health contributor by the composite name Health contributor exclusion rules aren't applied to child contributors Jan 4, 2022
@philwebb philwebb modified the milestones: 2.6.x, 2.6.3 Jan 4, 2022
@philwebb
Copy link
Member

philwebb commented Jan 4, 2022

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
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

3 participants