use of org.springframework.boot.actuate.endpoint.annotation.ReadOperation in project spring-boot by spring-projects.
the class ConditionsReportEndpoint method applicationConditionEvaluation.
@ReadOperation
public ApplicationConditionEvaluation applicationConditionEvaluation() {
Map<String, ContextConditionEvaluation> contextConditionEvaluations = new HashMap<>();
ConfigurableApplicationContext target = this.context;
while (target != null) {
contextConditionEvaluations.put(target.getId(), new ContextConditionEvaluation(target));
target = getConfigurableParent(target);
}
return new ApplicationConditionEvaluation(contextConditionEvaluations);
}
use of org.springframework.boot.actuate.endpoint.annotation.ReadOperation in project spring-boot by spring-projects.
the class LiquibaseEndpoint method liquibaseBeans.
@ReadOperation
public ApplicationLiquibaseBeans liquibaseBeans() {
ApplicationContext target = this.context;
Map<String, ContextLiquibaseBeans> contextBeans = new HashMap<>();
while (target != null) {
Map<String, LiquibaseBean> liquibaseBeans = new HashMap<>();
DatabaseFactory factory = DatabaseFactory.getInstance();
target.getBeansOfType(SpringLiquibase.class).forEach((name, liquibase) -> liquibaseBeans.put(name, createReport(liquibase, factory)));
ApplicationContext parent = target.getParent();
contextBeans.put(target.getId(), new ContextLiquibaseBeans(liquibaseBeans, (parent != null) ? parent.getId() : null));
target = parent;
}
return new ApplicationLiquibaseBeans(contextBeans);
}
use of org.springframework.boot.actuate.endpoint.annotation.ReadOperation in project spring-boot by spring-projects.
the class PrometheusScrapeEndpoint method scrape.
@ReadOperation(producesFrom = TextOutputFormat.class)
public WebEndpointResponse<String> scrape(TextOutputFormat format, @Nullable Set<String> includedNames) {
try {
Writer writer = new StringWriter();
Enumeration<MetricFamilySamples> samples = (includedNames != null) ? this.collectorRegistry.filteredMetricFamilySamples(includedNames) : this.collectorRegistry.metricFamilySamples();
format.write(writer, samples);
return new WebEndpointResponse<>(writer.toString(), format);
} catch (IOException ex) {
// This actually never happens since StringWriter doesn't throw an IOException
throw new IllegalStateException("Writing metrics failed", ex);
}
}
use of org.springframework.boot.actuate.endpoint.annotation.ReadOperation in project spring-boot by spring-projects.
the class BeansEndpoint method beans.
@ReadOperation
public ApplicationBeans beans() {
Map<String, ContextBeans> contexts = new HashMap<>();
ConfigurableApplicationContext context = this.context;
while (context != null) {
contexts.put(context.getId(), ContextBeans.describing(context));
context = getConfigurableParent(context);
}
return new ApplicationBeans(contexts);
}
use of org.springframework.boot.actuate.endpoint.annotation.ReadOperation in project spring-boot by spring-projects.
the class CachesEndpointWebExtension method cache.
@ReadOperation
public WebEndpointResponse<CacheEntry> cache(@Selector String cache, @Nullable String cacheManager) {
try {
CacheEntry entry = this.delegate.cache(cache, cacheManager);
int status = (entry != null) ? WebEndpointResponse.STATUS_OK : WebEndpointResponse.STATUS_NOT_FOUND;
return new WebEndpointResponse<>(entry, status);
} catch (NonUniqueCacheException ex) {
return new WebEndpointResponse<>(WebEndpointResponse.STATUS_BAD_REQUEST);
}
}
Aggregations