Commit fd5aa3eb authored by Johnny Lim's avatar Johnny Lim Committed by Stephane Nicoll

Polish

See gh-15134
parent 2c3b455b
...@@ -21,7 +21,7 @@ import java.time.Duration; ...@@ -21,7 +21,7 @@ import java.time.Duration;
import io.micrometer.core.instrument.Meter; import io.micrometer.core.instrument.Meter;
/** /**
* A service level agreement boundary for use when configuring micrometer. Can be * A service level agreement boundary for use when configuring Micrometer. Can be
* specified as either a {@link Long} (applicable to timers and distribution summaries) or * specified as either a {@link Long} (applicable to timers and distribution summaries) or
* a {@link Duration} (applicable to only timers). * a {@link Duration} (applicable to only timers).
* *
...@@ -57,7 +57,7 @@ public final class ServiceLevelAgreementBoundary { ...@@ -57,7 +57,7 @@ public final class ServiceLevelAgreementBoundary {
} }
/** /**
* Return a new {@link ServiceLevelAgreementBoundary} instance for the given long * Return a new {@link ServiceLevelAgreementBoundary} instance for the given String
* value. * value.
* @param value the source value * @param value the source value
* @return a {@link ServiceLevelAgreementBoundary} instance * @return a {@link ServiceLevelAgreementBoundary} instance
......
...@@ -131,8 +131,7 @@ public class PrometheusMetricsExportAutoConfiguration { ...@@ -131,8 +131,7 @@ public class PrometheusMetricsExportAutoConfiguration {
String job = properties.getJob(); String job = properties.getJob();
job = (job != null) ? job job = (job != null) ? job
: environment.getProperty("spring.application.name"); : environment.getProperty("spring.application.name");
job = (job != null) ? job : FALLBACK_JOB; return (job != null) ? job : FALLBACK_JOB;
return job;
} }
} }
......
...@@ -43,7 +43,7 @@ public class PrometheusProperties { ...@@ -43,7 +43,7 @@ public class PrometheusProperties {
* Configuration options for using Prometheus Pushgateway, allowing metrics to be * Configuration options for using Prometheus Pushgateway, allowing metrics to be
* pushed when they cannot be scraped. * pushed when they cannot be scraped.
*/ */
private Pushgateway pushgateway = new Pushgateway(); private final Pushgateway pushgateway = new Pushgateway();
/** /**
* Step size (i.e. reporting frequency) to use. * Step size (i.e. reporting frequency) to use.
...@@ -70,10 +70,6 @@ public class PrometheusProperties { ...@@ -70,10 +70,6 @@ public class PrometheusProperties {
return this.pushgateway; return this.pushgateway;
} }
public void setPushgateway(Pushgateway pushgateway) {
this.pushgateway = pushgateway;
}
/** /**
* Configuration options for push-based interaction with Prometheus. * Configuration options for push-based interaction with Prometheus.
*/ */
......
...@@ -34,7 +34,7 @@ import org.springframework.util.Assert; ...@@ -34,7 +34,7 @@ import org.springframework.util.Assert;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
/** /**
* Class that can be used to managed the pushing of metrics to a {@link PushGateway * Class that can be used to manage the pushing of metrics to a {@link PushGateway
* Prometheus PushGateway}. Handles the scheduling of push operations, error handling and * Prometheus PushGateway}. Handles the scheduling of push operations, error handling and
* shutdown operations. * shutdown operations.
* *
...@@ -115,9 +115,9 @@ public class PrometheusPushGatewayManager { ...@@ -115,9 +115,9 @@ public class PrometheusPushGatewayManager {
} }
catch (UnknownHostException ex) { catch (UnknownHostException ex) {
String host = ex.getMessage(); String host = ex.getMessage();
String message = "Unable to locate prometheus push gateway host"; String message = "Unable to locate prometheus push gateway host"
message += StringUtils.hasLength(host) ? " '" + host + "'" : ""; + (StringUtils.hasLength(host) ? " '" + host + "'" : "")
message += ". No longer attempting metrics publication to this host"; + ". No longer attempting metrics publication to this host";
logger.error(message, ex); logger.error(message, ex);
shutdown(ShutdownOperation.NONE); shutdown(ShutdownOperation.NONE);
} }
......
...@@ -213,13 +213,12 @@ class OnClassCondition extends FilteringSpringBootCondition { ...@@ -213,13 +213,12 @@ class OnClassCondition extends FilteringSpringBootCondition {
private ConditionOutcome getOutcome(String candidates) { private ConditionOutcome getOutcome(String candidates) {
try { try {
if (!candidates.contains(",")) { if (!candidates.contains(",")) {
return getOutcome(candidates, ClassNameFilter.MISSING, return getOutcome(candidates, this.beanClassLoader);
this.beanClassLoader);
} }
for (String candidate : StringUtils for (String candidate : StringUtils
.commaDelimitedListToStringArray(candidates)) { .commaDelimitedListToStringArray(candidates)) {
ConditionOutcome outcome = getOutcome(candidate, ConditionOutcome outcome = getOutcome(candidate,
ClassNameFilter.MISSING, this.beanClassLoader); this.beanClassLoader);
if (outcome != null) { if (outcome != null) {
return outcome; return outcome;
} }
...@@ -231,9 +230,8 @@ class OnClassCondition extends FilteringSpringBootCondition { ...@@ -231,9 +230,8 @@ class OnClassCondition extends FilteringSpringBootCondition {
return null; return null;
} }
private ConditionOutcome getOutcome(String className, private ConditionOutcome getOutcome(String className, ClassLoader classLoader) {
ClassNameFilter classNameFilter, ClassLoader classLoader) { if (ClassNameFilter.MISSING.matches(className, classLoader)) {
if (classNameFilter.matches(className, classLoader)) {
return ConditionOutcome.noMatch(ConditionMessage return ConditionOutcome.noMatch(ConditionMessage
.forCondition(ConditionalOnClass.class) .forCondition(ConditionalOnClass.class)
.didNotFind("required class").items(Style.QUOTE, className)); .didNotFind("required class").items(Style.QUOTE, className));
......
...@@ -1011,11 +1011,6 @@ ...@@ -1011,11 +1011,6 @@
<artifactId>netty-tcnative-boringssl-static</artifactId> <artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${netty-tcnative.version}</version> <version>${netty-tcnative.version}</version>
</dependency> </dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_pushgateway</artifactId>
<version>${prometheus-pushgateway.version}</version>
</dependency>
<dependency> <dependency>
<groupId>io.projectreactor</groupId> <groupId>io.projectreactor</groupId>
<artifactId>reactor-bom</artifactId> <artifactId>reactor-bom</artifactId>
...@@ -1023,6 +1018,11 @@ ...@@ -1023,6 +1018,11 @@
<scope>import</scope> <scope>import</scope>
<type>pom</type> <type>pom</type>
</dependency> </dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_pushgateway</artifactId>
<version>${prometheus-pushgateway.version}</version>
</dependency>
<dependency> <dependency>
<groupId>io.reactivex</groupId> <groupId>io.reactivex</groupId>
<artifactId>rxjava</artifactId> <artifactId>rxjava</artifactId>
......
...@@ -2013,7 +2013,7 @@ include::{code-examples}/jpa/HibernateSecondLevelCacheExample.java[tag=configura ...@@ -2013,7 +2013,7 @@ include::{code-examples}/jpa/HibernateSecondLevelCacheExample.java[tag=configura
---- ----
This customizer will configure Hibernate to use the same `CacheManager` as the one that This customizer will configure Hibernate to use the same `CacheManager` as the one that
the application uses. It is also possible to use separate `CacheManager` instances, refer the application uses. It is also possible to use separate `CacheManager` instances. For details, refer
to {hibernate-documentation}#caching-provider-jcache[the Hibernate user guide]. to {hibernate-documentation}#caching-provider-jcache[the Hibernate user guide].
......
...@@ -1436,7 +1436,7 @@ annotation markers. ...@@ -1436,7 +1436,7 @@ annotation markers.
[[production-ready-metrics-export-appoptics]] [[production-ready-metrics-export-appoptics]]
==== AppOptics ==== AppOptics
By default, the AppOptics registry pushes metrics to https://www.appoptics.com/ By default, the AppOptics registry pushes metrics to https://api.appoptics.com/v1/measurements
periodically. To export metrics to SaaS periodically. To export metrics to SaaS
{micrometer-registry-documentation}/appoptics[AppOptics], your API token must be provided: {micrometer-registry-documentation}/appoptics[AppOptics], your API token must be provided:
......
...@@ -62,6 +62,7 @@ public class FilteredClassLoader extends URLClassLoader { ...@@ -62,6 +62,7 @@ public class FilteredClassLoader extends URLClassLoader {
* Create a {@link FilteredClassLoader} that hides resources from the given * Create a {@link FilteredClassLoader} that hides resources from the given
* {@link ClassPathResource classpath resources}. * {@link ClassPathResource classpath resources}.
* @param hiddenResources the resources to hide * @param hiddenResources the resources to hide
* @since 2.1.0
*/ */
public FilteredClassLoader(ClassPathResource... hiddenResources) { public FilteredClassLoader(ClassPathResource... hiddenResources) {
this(Collections.emptyList(), this(Collections.emptyList(),
...@@ -164,6 +165,8 @@ public class FilteredClassLoader extends URLClassLoader { ...@@ -164,6 +165,8 @@ public class FilteredClassLoader extends URLClassLoader {
/** /**
* Filter to restrict the resources that can be loaded. * Filter to restrict the resources that can be loaded.
*
* @since 2.1.0
*/ */
public static final class ClassPathResourceFilter implements Predicate<String> { public static final class ClassPathResourceFilter implements Predicate<String> {
......
...@@ -243,7 +243,7 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor { ...@@ -243,7 +243,7 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor {
NamedValuesExtractor(String... names) { NamedValuesExtractor(String... names) {
this.names = new HashSet<>(Arrays.asList(names)); this.names = new HashSet<>(Arrays.asList(names));
}; }
@Override @Override
public List<Object> getValues(AnnotationMirror annotation) { public List<Object> getValues(AnnotationMirror annotation) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment