Search in sources :

Example 1 with AdditionalHealthEndpointPath

use of org.springframework.boot.actuate.health.AdditionalHealthEndpointPath in project spring-boot by spring-projects.

the class AdditionalHealthEndpointPathsWebMvcHandlerMapping method initHandlerMethods.

@Override
protected void initHandlerMethods() {
    for (WebOperation operation : this.endpoint.getOperations()) {
        WebOperationRequestPredicate predicate = operation.getRequestPredicate();
        String matchAllRemainingPathSegmentsVariable = predicate.getMatchAllRemainingPathSegmentsVariable();
        if (matchAllRemainingPathSegmentsVariable != null) {
            for (HealthEndpointGroup group : this.groups) {
                AdditionalHealthEndpointPath additionalPath = group.getAdditionalPath();
                if (additionalPath != null) {
                    registerMapping(this.endpoint, predicate, operation, additionalPath.getValue());
                }
            }
        }
    }
}
Also used : WebOperation(org.springframework.boot.actuate.endpoint.web.WebOperation) WebOperationRequestPredicate(org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate) AdditionalHealthEndpointPath(org.springframework.boot.actuate.health.AdditionalHealthEndpointPath) HealthEndpointGroup(org.springframework.boot.actuate.health.HealthEndpointGroup)

Example 2 with AdditionalHealthEndpointPath

use of org.springframework.boot.actuate.health.AdditionalHealthEndpointPath in project spring-boot by spring-projects.

the class AutoConfiguredHealthEndpointGroups method createGroups.

private Map<String, HealthEndpointGroup> createGroups(Map<String, Group> groupProperties, BeanFactory beanFactory, StatusAggregator defaultStatusAggregator, HttpCodeStatusMapper defaultHttpCodeStatusMapper, Show defaultShowComponents, Show defaultShowDetails, Set<String> defaultRoles) {
    Map<String, HealthEndpointGroup> groups = new LinkedHashMap<>();
    groupProperties.forEach((groupName, group) -> {
        Status status = group.getStatus();
        Show showComponents = (group.getShowComponents() != null) ? group.getShowComponents() : defaultShowComponents;
        Show showDetails = (group.getShowDetails() != null) ? group.getShowDetails() : defaultShowDetails;
        Set<String> roles = !CollectionUtils.isEmpty(group.getRoles()) ? group.getRoles() : defaultRoles;
        StatusAggregator statusAggregator = getQualifiedBean(beanFactory, StatusAggregator.class, groupName, () -> {
            if (!CollectionUtils.isEmpty(status.getOrder())) {
                return new SimpleStatusAggregator(status.getOrder());
            }
            return defaultStatusAggregator;
        });
        HttpCodeStatusMapper httpCodeStatusMapper = getQualifiedBean(beanFactory, HttpCodeStatusMapper.class, groupName, () -> {
            if (!CollectionUtils.isEmpty(status.getHttpMapping())) {
                return new SimpleHttpCodeStatusMapper(status.getHttpMapping());
            }
            return defaultHttpCodeStatusMapper;
        });
        Predicate<String> members = new IncludeExcludeGroupMemberPredicate(group.getInclude(), group.getExclude());
        AdditionalHealthEndpointPath additionalPath = (group.getAdditionalPath() != null) ? AdditionalHealthEndpointPath.from(group.getAdditionalPath()) : null;
        groups.put(groupName, new AutoConfiguredHealthEndpointGroup(members, statusAggregator, httpCodeStatusMapper, showComponents, showDetails, roles, additionalPath));
    });
    return Collections.unmodifiableMap(groups);
}
Also used : Status(org.springframework.boot.actuate.autoconfigure.health.HealthProperties.Status) SimpleStatusAggregator(org.springframework.boot.actuate.health.SimpleStatusAggregator) AdditionalHealthEndpointPath(org.springframework.boot.actuate.health.AdditionalHealthEndpointPath) HealthEndpointGroup(org.springframework.boot.actuate.health.HealthEndpointGroup) LinkedHashMap(java.util.LinkedHashMap) SimpleStatusAggregator(org.springframework.boot.actuate.health.SimpleStatusAggregator) StatusAggregator(org.springframework.boot.actuate.health.StatusAggregator) HttpCodeStatusMapper(org.springframework.boot.actuate.health.HttpCodeStatusMapper) SimpleHttpCodeStatusMapper(org.springframework.boot.actuate.health.SimpleHttpCodeStatusMapper) Show(org.springframework.boot.actuate.autoconfigure.health.HealthProperties.Show) SimpleHttpCodeStatusMapper(org.springframework.boot.actuate.health.SimpleHttpCodeStatusMapper)

Example 3 with AdditionalHealthEndpointPath

use of org.springframework.boot.actuate.health.AdditionalHealthEndpointPath in project spring-boot by spring-projects.

the class AdditionalHealthEndpointPathsWebFluxHandlerMapping method initHandlerMethods.

@Override
protected void initHandlerMethods() {
    for (WebOperation operation : this.endpoint.getOperations()) {
        WebOperationRequestPredicate predicate = operation.getRequestPredicate();
        String matchAllRemainingPathSegmentsVariable = predicate.getMatchAllRemainingPathSegmentsVariable();
        if (matchAllRemainingPathSegmentsVariable != null) {
            for (HealthEndpointGroup group : this.groups) {
                AdditionalHealthEndpointPath additionalPath = group.getAdditionalPath();
                if (additionalPath != null) {
                    RequestMappingInfo requestMappingInfo = getRequestMappingInfo(operation, additionalPath.getValue());
                    registerReadMapping(requestMappingInfo, this.endpoint, operation);
                }
            }
        }
    }
}
Also used : WebOperation(org.springframework.boot.actuate.endpoint.web.WebOperation) WebOperationRequestPredicate(org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate) AdditionalHealthEndpointPath(org.springframework.boot.actuate.health.AdditionalHealthEndpointPath) RequestMappingInfo(org.springframework.web.reactive.result.method.RequestMappingInfo) HealthEndpointGroup(org.springframework.boot.actuate.health.HealthEndpointGroup)

Aggregations

AdditionalHealthEndpointPath (org.springframework.boot.actuate.health.AdditionalHealthEndpointPath)3 HealthEndpointGroup (org.springframework.boot.actuate.health.HealthEndpointGroup)3 WebOperation (org.springframework.boot.actuate.endpoint.web.WebOperation)2 WebOperationRequestPredicate (org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate)2 LinkedHashMap (java.util.LinkedHashMap)1 Show (org.springframework.boot.actuate.autoconfigure.health.HealthProperties.Show)1 Status (org.springframework.boot.actuate.autoconfigure.health.HealthProperties.Status)1 HttpCodeStatusMapper (org.springframework.boot.actuate.health.HttpCodeStatusMapper)1 SimpleHttpCodeStatusMapper (org.springframework.boot.actuate.health.SimpleHttpCodeStatusMapper)1 SimpleStatusAggregator (org.springframework.boot.actuate.health.SimpleStatusAggregator)1 StatusAggregator (org.springframework.boot.actuate.health.StatusAggregator)1 RequestMappingInfo (org.springframework.web.reactive.result.method.RequestMappingInfo)1