Closes gh-11206
This commit is contained in:
Johnny Lim 2017-11-30 01:12:35 +09:00 committed by Phillip Webb
parent 7ebe4935ac
commit 44299bb980
7 changed files with 24 additions and 20 deletions

View File

@ -35,7 +35,7 @@ public class DatadogProperties extends StepRegistryProperties {
/**
* Tag that will be mapped to "host" when shipping metrics to Datadog. Can be
* omitted of host should be omitted on publishing.
* omitted if host should be omitted on publishing.
*/
private String hostTag;

View File

@ -32,7 +32,7 @@ public class InfluxProperties extends StepRegistryProperties {
/**
* Tag that will be mapped to "host" when shipping metrics to Influx. Can be
* omitted of host should be omitted on publishing.
* omitted if host should be omitted on publishing.
*/
private String db;

View File

@ -33,6 +33,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.jdbc.metadata.DataSourcePoolMetadataProvider;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;
/**
* Configure metrics for all available {@link DataSource datasources}.
@ -80,7 +81,7 @@ public class DataSourcePoolMetricsConfiguration {
*/
private String getDataSourceName(String beanName) {
if (beanName.length() > DATASOURCE_SUFFIX.length()
&& beanName.toLowerCase().endsWith(DATASOURCE_SUFFIX.toLowerCase())) {
&& StringUtils.endsWithIgnoreCase(beanName, DATASOURCE_SUFFIX)) {
return beanName.substring(0, beanName.length() - DATASOURCE_SUFFIX.length());
}
return beanName;

View File

@ -1250,21 +1250,22 @@ content into your application. Rather, pick only the properties that you need.
spring.metrics.export.atlas.config-time-to-live= # Time to live for subscriptions from the LWC service.
spring.metrics.export.atlas.config-uri= # URI for the Atlas LWC endpoint to retrieve current subscriptions.
spring.metrics.export.atlas.connect-timeout= # Connection timeout for requests to the backend.
spring.metrics.export.atlas.enabled= # Whether exporting of metrics to Atlas is enabled.
spring.metrics.export.atlas.enabled= # Whether exporting of metrics to this backend is enabled.
spring.metrics.export.atlas.eval-uri= # URI for the Atlas LWC endpoint to evaluate the data for a subscription.
spring.metrics.export.atlas.lwc-enabled= # Enable streaming to Atlas LWC.
spring.metrics.export.atlas.meter-time-to-live= # Time to live for meters that do not have any activity. After this period the meter will be considered expired and will not get reported.
spring.metrics.export.atlas.num-threads= # Number of threads to use with the metrics publishing scheduler.
spring.metrics.export.atlas.read-timeout= # Read timeout for requests to the backend.
spring.metrics.export.atlas.step=1 # Step size (i.e. reporting frequency) to use.
spring.metrics.export.atlas.step=1m # Step size (i.e. reporting frequency) to use.
spring.metrics.export.atlas.uri= # URI of the Atlas server.
spring.metrics.export.datadog.api-key= # Datadog API key.
spring.metrics.export.datadog.batch-size= # Number of measurements per request to use for the backend. If more measurements are found, then multiple requests will be made.
spring.metrics.export.datadog.connect-timeout= # Connection timeout for requests to the backend.
spring.metrics.export.datadog.enabled= # Enable publishing to the backend.
spring.metrics.export.datadog.enabled= # Whether exporting of metrics to this backend is enabled.
spring.metrics.export.datadog.host-tag= # Tag that will be mapped to "host" when shipping metrics to Datadog. Can be omitted if host should be omitted on publishing.
spring.metrics.export.datadog.num-threads= # Number of threads to use with the metrics publishing scheduler.
spring.metrics.export.datadog.read-timeout= # Read timeout for requests to the backend.
spring.metrics.export.datadog.step=1 # Step size (i.e. reporting frequency) to use.
spring.metrics.export.datadog.step=1m # Step size (i.e. reporting frequency) to use.
spring.metrics.export.datadog.uri= # URI to ship metrics to. If you need to publish metrics to an internal proxy en-route to Datadog, you can define the location of the proxy with this.
spring.metrics.export.ganglia.addressing-mode= # UDP addressing mode, either unicast or multicast.
spring.metrics.export.ganglia.duration-units= # Base time unit used to report durations.
@ -1286,13 +1287,13 @@ content into your application. Rather, pick only the properties that you need.
spring.metrics.export.influx.compressed= # Enable GZIP compression of metrics batches published to Influx.
spring.metrics.export.influx.connect-timeout= # Connection timeout for requests to the backend.
spring.metrics.export.influx.consistency= # Write consistency for each point.
spring.metrics.export.influx.db= # Tag that will be mapped to "host" when shipping metrics to Influx. Can be omitted of host should be omitted on publishing.
spring.metrics.export.influx.enabled= # Whether exporting of metrics to InfluxDB is enabled.
spring.metrics.export.influx.db= # Tag that will be mapped to "host" when shipping metrics to Influx. Can be omitted if host should be omitted on publishing.
spring.metrics.export.influx.enabled= # Whether exporting of metrics to this backend is enabled.
spring.metrics.export.influx.num-threads= # Number of threads to use with the metrics publishing scheduler.
spring.metrics.export.influx.password= # Login password of the Influx server.
spring.metrics.export.influx.read-timeout= # Read timeout for requests to the backend.
spring.metrics.export.influx.retention-policy= # Retention policy to use (Influx writes to the DEFAULT retention policy if one is not specified).
spring.metrics.export.influx.step=1 # Step size (i.e. reporting frequency) to use.
spring.metrics.export.influx.step=1m # Step size (i.e. reporting frequency) to use.
spring.metrics.export.influx.uri= # URI of the Influx server.
spring.metrics.export.influx.user-name= # Login user of the Influx server.
spring.metrics.export.prometheus.descriptions= # Enable publishing descriptions as part of the scrape payload to Prometheus. Turn this off to minimize the amount of data sent on each scrape.
@ -1300,14 +1301,14 @@ content into your application. Rather, pick only the properties that you need.
spring.metrics.export.prometheus.step= # Step size (i.e. reporting frequency) to use.
spring.metrics.export.simple.enabled=false # Whether exporting of metrics to a simple in-memory store is enabled.
spring.metrics.export.simple.mode=cumulative # Counting mode.
spring.metrics.export.simple.step=10 # Step size (i.e. reporting frequency) to use.
spring.metrics.export.simple.step=10s # Step size (i.e. reporting frequency) to use.
spring.metrics.export.statsd.enabled= # Export metrics to StatsD.
spring.metrics.export.statsd.flavor= # StatsD line protocol to use.
spring.metrics.export.statsd.flavor=datadog # StatsD line protocol to use.
spring.metrics.export.statsd.host=localhost # Host of the StatsD server to receive exported metrics.
spring.metrics.export.statsd.max-packet-length=1400 # Total length of a single payload should be kept within your network's MTU.
spring.metrics.export.statsd.polling-frequency=10 # How often gauges will be polled. When a gauge is polled, its value is recalculated and if the value has changed, it is sent to the StatsD server.
spring.metrics.export.statsd.polling-frequency=10s # How often gauges will be polled. When a gauge is polled, its value is recalculated and if the value has changed, it is sent to the StatsD server.
spring.metrics.export.statsd.port=8125 # Port of the StatsD server to receive exported metrics.
spring.metrics.export.statsd.queue-size= # Maximum size of the queue of items waiting to be sent to the StatsD server.
spring.metrics.export.statsd.queue-size=2147483647 # Maximum size of the queue of items waiting to be sent to the StatsD server.
spring.metrics.jdbc.datasource-metric-name=data.source # Name of the metric for data source usage.
spring.metrics.jdbc.instrument-datasource=true # Instrument all available data sources.
spring.metrics.web.client.record-request-percentiles=false # Whether instrumented requests record percentiles histogram buckets by default.

View File

@ -42,13 +42,14 @@ public final class Layouts {
if (file == null) {
throw new IllegalArgumentException("File must not be null");
}
if (file.getName().toLowerCase().endsWith(".jar")) {
String lowerCaseFileName = file.getName().toLowerCase();
if (lowerCaseFileName.endsWith(".jar")) {
return new Jar();
}
if (file.getName().toLowerCase().endsWith(".war")) {
if (lowerCaseFileName.endsWith(".war")) {
return new War();
}
if (file.isDirectory() || file.getName().toLowerCase().endsWith(".zip")) {
if (file.isDirectory() || lowerCaseFileName.endsWith(".zip")) {
return new Expanded();
}
throw new IllegalStateException("Unable to deduce layout for '" + file + "'");

View File

@ -555,7 +555,8 @@ public class PropertiesLauncher extends Launcher {
if (path.startsWith("./")) {
path = path.substring(2);
}
if (path.toLowerCase().endsWith(".jar") || path.toLowerCase().endsWith(".zip")) {
String lowerCasePath = path.toLowerCase();
if (lowerCasePath.endsWith(".jar") || lowerCasePath.endsWith(".zip")) {
return path;
}
if (path.endsWith("/*")) {

View File

@ -422,8 +422,8 @@ public class ConfigFileApplicationListener
}
private boolean canLoadFileExtension(PropertySourceLoader loader, String name) {
return Arrays.stream(loader.getFileExtensions()).map(String::toLowerCase)
.anyMatch(name.toLowerCase()::endsWith);
return Arrays.stream(loader.getFileExtensions()).anyMatch(
fileExtension -> StringUtils.endsWithIgnoreCase(name, fileExtension));
}
private void loadForFileExtension(PropertySourceLoader loader, Profile profile,