org.springframework.boot.actuate.info.Info.Builder Java Examples

The following examples show how to use org.springframework.boot.actuate.info.Info.Builder. 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: KubernetesInfoContributor.java    From spring-cloud-kubernetes with Apache License 2.0 6 votes vote down vote up
@Override
public void contribute(Builder builder) {
	try {
		Pod current = this.utils.currentPod().get();
		Map<String, Object> details = new HashMap<>();
		if (current != null) {
			details.put("inside", true);
			details.put("namespace", current.getMetadata().getNamespace());
			details.put("podName", current.getMetadata().getName());
			details.put("podIp", current.getStatus().getPodIP());
			details.put("serviceAccount", current.getSpec().getServiceAccountName());
			details.put("nodeName", current.getSpec().getNodeName());
			details.put("hostIp", current.getStatus().getHostIP());
		}
		else {
			details.put("inside", false);
		}
		builder.withDetail("kubernetes", details);
	}
	catch (Exception e) {
		LOG.warn("Failed to get pod details", e);
	}
}
 
Example #2
Source File: TacoCountInfoContributor.java    From spring-in-action-5-samples with Apache License 2.0 5 votes vote down vote up
@Override
public void contribute(Builder builder) {
  long tacoCount = tacoRepo.count();
  Map<String, Object> tacoMap = new HashMap<String, Object>();
  tacoMap.put("count", tacoCount);
  builder.withDetail("taco-stats", tacoMap);
}
 
Example #3
Source File: TacoCountInfoContributor.java    From spring-in-action-5-samples with Apache License 2.0 5 votes vote down vote up
@Override
public void contribute(Builder builder) {
  long tacoCount = tacoRepo.count();
  Map<String, Object> tacoMap = new HashMap<String, Object>();
  tacoMap.put("count", tacoCount);
  builder.withDetail("taco-stats", tacoMap);
}
 
Example #4
Source File: TacoCountInfoContributor.java    From spring-in-action-5-samples with Apache License 2.0 5 votes vote down vote up
@Override
public void contribute(Builder builder) {
  long tacoCount = tacoRepo.count();
  Map<String, Object> tacoMap = new HashMap<String, Object>();
  tacoMap.put("count", tacoCount);
  builder.withDetail("taco-stats", tacoMap);
}
 
Example #5
Source File: TacoCountInfoContributor.java    From spring-in-action-5-samples with Apache License 2.0 5 votes vote down vote up
@Override
public void contribute(Builder builder) {
  long tacoCount = tacoRepo.count();
  Map<String, Object> tacoMap = new HashMap<String, Object>();
  tacoMap.put("count", tacoCount);
  builder.withDetail("taco-stats", tacoMap);
}
 
Example #6
Source File: LeaderInfoContributor.java    From spring-cloud-kubernetes with Apache License 2.0 5 votes vote down vote up
@Override
public void contribute(Builder builder) {
	Map<String, Object> details = new HashMap<>();
	Optional<Leader> leader = leadershipController.getLocalLeader();
	if (leader.isPresent()) {
		Leader l = leader.get();
		details.put("leaderId", l.getId());
		details.put("role", l.getRole());
		details.put("isLeader", l.isCandidate(candidate));
	}
	else {
		details.put("leaderId", "Unknown");
	}
	builder.withDetail("leaderElection", details);
}
 
Example #7
Source File: ReportsArchiver.java    From difido-reports with Apache License 2.0 5 votes vote down vote up
/**
 * Provides information about the internal status and operations of the
 * archiver. Can be triggered by calling to <code>/info</code>
 */
@Override
public void contribute(Builder builder) {
	if (!enabled) {
		return;
	}
	builder.withDetail("reports archiver", archiveHistory).build();
}
 
Example #8
Source File: ExecutionSummaryUpdaterController.java    From difido-reports with Apache License 2.0 5 votes vote down vote up
/**
 * Info about the server that can be retrieved using the
 * http://<host>:<port>/info request
 */
@Override
public void contribute(Builder builder) {
	Map<String, Integer> metadataDetails = new HashMap<>();
	metadataDetails.put("existing executions", (int) metadataRepository.count());
	metadataDetails.put("active executions", (int) executionRepository.count());
	builder.withDetail("execution summary controller", metadataDetails);
}
 
Example #9
Source File: AccessTimeUpdaterController.java    From difido-reports with Apache License 2.0 5 votes vote down vote up
/**
 * Info about the server that can be retrieved using the
 * http://<host>:<port>/info request
 */
@Override
public void contribute(Builder builder) {
	final Map<String, Integer> metadataDetails = new HashMap<>();
	metadataDetails.put("enabled", enabled ? 1 : 0);
	if (enabled) {
		metadataDetails.put("active executions", (int) accessTimePerExecution.size());
	}
	builder.withDetail("access time updater controller", metadataDetails);
}
 
Example #10
Source File: PluginController.java    From difido-reports with Apache License 2.0 5 votes vote down vote up
/**
 * Info about the server that can be retrieved using the
 * http://<host>:<port>/info request
 */
@Override
public void contribute(Builder builder) {
	Map<String, String> pluginDetails = new HashMap<>();
	List<Plugin> plugins = pluginManager.getPlugins(Plugin.class);
	pluginDetails.put("number of plugins", plugins.size() + "");
	pluginDetails.put("plugins", plugins.stream().map(p -> p.getName()).collect(Collectors.toList()).toString());
	builder.withDetail("plugin controller", pluginDetails).build();

}