org.springframework.boot.actuate.info.InfoContributor Java Examples

The following examples show how to use org.springframework.boot.actuate.info.InfoContributor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GrpcServerMetricAutoConfiguration.java    From grpc-spring-boot-starter with MIT License 6 votes vote down vote up
@Bean
@Lazy
InfoContributor grpcInfoContributor(final GrpcServerProperties properties,
        final Collection<BindableService> grpcServices, final HealthStatusManager healthStatusManager) {
    final Map<String, Object> details = new LinkedHashMap<>();
    details.put("port", properties.getPort());

    if (properties.isReflectionServiceEnabled()) {
        // Only expose services via web-info if we do the same via grpc.
        final Map<String, List<String>> services = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
        details.put("services", services);
        final List<BindableService> mutableGrpcServiceList = new ArrayList<>(grpcServices);
        mutableGrpcServiceList.add(ProtoReflectionService.newInstance());
        if (properties.isHealthServiceEnabled()) {
            mutableGrpcServiceList.add(healthStatusManager.getHealthService());
        }
        for (final BindableService grpcService : mutableGrpcServiceList) {
            final ServiceDescriptor serviceDescriptor = grpcService.bindService().getServiceDescriptor();

            final List<String> methods = collectMethodNamesForService(serviceDescriptor);
            services.put(serviceDescriptor.getName(), methods);
        }
    }

    return new SimpleInfoContributor("grpc.server", details);
}
 
Example #2
Source File: GrpcServerMetricAutoConfiguration.java    From grpc-spring-boot-starter with MIT License 6 votes vote down vote up
@Bean
@Lazy
InfoContributor grpcInfoContributor(final GrpcServerProperties properties,
        final Collection<BindableService> grpcServices, final HealthStatusManager healthStatusManager) {
    final Map<String, Object> details = new LinkedHashMap<>();
    details.put("port", properties.getPort());

    if (properties.isReflectionServiceEnabled()) {
        // Only expose services via web-info if we do the same via grpc.
        final Map<String, List<String>> services = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
        details.put("services", services);
        final List<BindableService> mutableGrpcServiceList = new ArrayList<>(grpcServices);
        mutableGrpcServiceList.add(ProtoReflectionService.newInstance());
        if (properties.isHealthServiceEnabled()) {
            mutableGrpcServiceList.add(healthStatusManager.getHealthService());
        }
        for (final BindableService grpcService : mutableGrpcServiceList) {
            final ServiceDescriptor serviceDescriptor = grpcService.bindService().getServiceDescriptor();

            final List<String> methods = collectMethodNamesForService(serviceDescriptor);
            services.put(serviceDescriptor.getName(), methods);
        }
    }

    return new SimpleInfoContributor("grpc.server", details);
}
 
Example #3
Source File: CamelInfoAutoConfiguration.java    From camel-spring-boot with Apache License 2.0 4 votes vote down vote up
@Bean
public InfoContributor camelInfoContributor(CamelContext camelContext) {
    return new CamelInfoContributor(camelContext);
}
 
Example #4
Source File: LeaderAutoConfiguration.java    From spring-cloud-kubernetes with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnClass(InfoContributor.class)
public LeaderInfoContributor leaderInfoContributor(
		LeadershipController leadershipController, Candidate candidate) {
	return new LeaderInfoContributor(leadershipController, candidate);
}
 
Example #5
Source File: MgmtConfig.java    From secrets-proxy with Apache License 2.0 2 votes vote down vote up
/**
 * Contribute SpringBoot version to "/info".
 *
 * @return {@link InfoContributor}
 */
@Bean
public InfoContributor versionInfo() {
  return builder -> builder.withDetail("spring-boot.version", SpringBootVersion.getVersion());
}