Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
izeye authored and snicoll committed Nov 11, 2018
1 parent 2c3b455 commit fd5aa3e
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
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
* a {@link Duration} (applicable to only timers).
*
Expand Down Expand Up @@ -57,7 +57,7 @@ public static ServiceLevelAgreementBoundary valueOf(long value) {
}

/**
* Return a new {@link ServiceLevelAgreementBoundary} instance for the given long
* Return a new {@link ServiceLevelAgreementBoundary} instance for the given String
* value.
* @param value the source value
* @return a {@link ServiceLevelAgreementBoundary} instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ private String getJob(PrometheusProperties.Pushgateway properties,
String job = properties.getJob();
job = (job != null) ? job
: environment.getProperty("spring.application.name");
job = (job != null) ? job : FALLBACK_JOB;
return job;
return (job != null) ? job : FALLBACK_JOB;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class PrometheusProperties {
* Configuration options for using Prometheus Pushgateway, allowing metrics to be
* 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.
Expand All @@ -70,10 +70,6 @@ public Pushgateway getPushgateway() {
return this.pushgateway;
}

public void setPushgateway(Pushgateway pushgateway) {
this.pushgateway = pushgateway;
}

/**
* Configuration options for push-based interaction with Prometheus.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
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
* shutdown operations.
*
Expand Down Expand Up @@ -115,9 +115,9 @@ private void push() {
}
catch (UnknownHostException ex) {
String host = ex.getMessage();
String message = "Unable to locate prometheus push gateway host";
message += StringUtils.hasLength(host) ? " '" + host + "'" : "";
message += ". No longer attempting metrics publication to this host";
String message = "Unable to locate prometheus push gateway host"
+ (StringUtils.hasLength(host) ? " '" + host + "'" : "")
+ ". No longer attempting metrics publication to this host";
logger.error(message, ex);
shutdown(ShutdownOperation.NONE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,12 @@ private ConditionOutcome[] getOutcomes(String[] autoConfigurationClasses,
private ConditionOutcome getOutcome(String candidates) {
try {
if (!candidates.contains(",")) {
return getOutcome(candidates, ClassNameFilter.MISSING,
this.beanClassLoader);
return getOutcome(candidates, this.beanClassLoader);
}
for (String candidate : StringUtils
.commaDelimitedListToStringArray(candidates)) {
ConditionOutcome outcome = getOutcome(candidate,
ClassNameFilter.MISSING, this.beanClassLoader);
this.beanClassLoader);
if (outcome != null) {
return outcome;
}
Expand All @@ -231,9 +230,8 @@ private ConditionOutcome getOutcome(String candidates) {
return null;
}

private ConditionOutcome getOutcome(String className,
ClassNameFilter classNameFilter, ClassLoader classLoader) {
if (classNameFilter.matches(className, classLoader)) {
private ConditionOutcome getOutcome(String className, ClassLoader classLoader) {
if (ClassNameFilter.MISSING.matches(className, classLoader)) {
return ConditionOutcome.noMatch(ConditionMessage
.forCondition(ConditionalOnClass.class)
.didNotFind("required class").items(Style.QUOTE, className));
Expand Down
10 changes: 5 additions & 5 deletions spring-boot-project/spring-boot-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1011,18 +1011,18 @@
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${netty-tcnative.version}</version>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_pushgateway</artifactId>
<version>${prometheus-pushgateway.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-bom</artifactId>
<version>${reactor-bom.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_pushgateway</artifactId>
<version>${prometheus-pushgateway.version}</version>
</dependency>
<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxjava</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
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].


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ annotation markers.

[[production-ready-metrics-export-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
{micrometer-registry-documentation}/appoptics[AppOptics], your API token must be provided:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public FilteredClassLoader(String... hiddenPackages) {
* Create a {@link FilteredClassLoader} that hides resources from the given
* {@link ClassPathResource classpath resources}.
* @param hiddenResources the resources to hide
* @since 2.1.0
*/
public FilteredClassLoader(ClassPathResource... hiddenResources) {
this(Collections.emptyList(),
Expand Down Expand Up @@ -164,6 +165,8 @@ public static PackageFilter of(String... hiddenPackages) {

/**
* Filter to restrict the resources that can be loaded.
*
* @since 2.1.0
*/
public static final class ClassPathResourceFilter implements Predicate<String> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ private static class NamedValuesExtractor extends AbstractValueExtractor {

NamedValuesExtractor(String... names) {
this.names = new HashSet<>(Arrays.asList(names));
};
}

@Override
public List<Object> getValues(AnnotationMirror annotation) {
Expand Down

0 comments on commit fd5aa3e

Please sign in to comment.