mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Move micrometer export related keys under a common prefix #10858
Closes gh-10858
This commit is contained in:
parent
2ae4678b1e
commit
9b8fefb0f4
@ -50,7 +50,7 @@ public class AtlasExportConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "spring.metrics.atlas.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.metrics.export.atlas.enabled", matchIfMissing = true)
|
||||
public MetricsExporter atlasExporter(AtlasConfig atlasConfig, Clock clock) {
|
||||
return () -> new AtlasMeterRegistry(atlasConfig, clock);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @since 2.0.0
|
||||
* @author Jon Schneider
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.metrics.atlas")
|
||||
@ConfigurationProperties(prefix = "spring.metrics.export.atlas")
|
||||
public class AtlasProperties extends StepRegistryProperties {
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ public class DatadogExportConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "spring.metrics.datadog.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.metrics.export.datadog.enabled", matchIfMissing = true)
|
||||
public MetricsExporter datadogExporter(DatadogConfig datadogConfig, Clock clock) {
|
||||
return () -> new DatadogMeterRegistry(datadogConfig, clock);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @author Jon Schneider
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.metrics.datadog")
|
||||
@ConfigurationProperties(prefix = "spring.metrics.export.datadog")
|
||||
public class DatadogProperties extends StepRegistryProperties {
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ public class GangliaExportConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "spring.metrics.ganglia.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.metrics.export.ganglia.enabled", matchIfMissing = true)
|
||||
public MetricsExporter gangliaExporter(GangliaConfig gangliaConfig,
|
||||
HierarchicalNameMapper nameMapper, Clock clock) {
|
||||
return () -> new GangliaMeterRegistry(gangliaConfig, nameMapper, clock);
|
||||
|
@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @author Jon Schneider
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.metrics.ganglia")
|
||||
@ConfigurationProperties(prefix = "spring.metrics.export.ganglia")
|
||||
public class GangliaProperties {
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ public class GraphiteExportConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "spring.metrics.graphite.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.metrics.export.graphite.enabled", matchIfMissing = true)
|
||||
public MetricsExporter graphiteExporter(GraphiteConfig graphiteConfig,
|
||||
HierarchicalNameMapper nameMapper, Clock clock) {
|
||||
return () -> new GraphiteMeterRegistry(graphiteConfig, nameMapper, clock);
|
||||
|
@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @author Jon Schneider
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.metrics.graphite")
|
||||
@ConfigurationProperties(prefix = "spring.metrics.export.graphite")
|
||||
public class GraphiteProperties {
|
||||
|
||||
/**
|
||||
|
@ -49,7 +49,7 @@ public class InfluxExportConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "spring.metrics.influx.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.metrics.export.influx.enabled", matchIfMissing = true)
|
||||
public MetricsExporter influxExporter(InfluxConfig influxConfig, Clock clock) {
|
||||
return () -> new InfluxMeterRegistry(influxConfig, clock);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @author Jon Schneider
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.metrics.influx")
|
||||
@ConfigurationProperties(prefix = "spring.metrics.export.influx")
|
||||
public class InfluxProperties extends StepRegistryProperties {
|
||||
/**
|
||||
* The tag that will be mapped to "host" when shipping metrics to Influx, or
|
||||
|
@ -38,7 +38,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
public class JmxExportConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "spring.metrics.jmx.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.metrics.export.jmx.enabled", matchIfMissing = true)
|
||||
public MetricsExporter jmxExporter(HierarchicalNameMapper nameMapper, Clock clock) {
|
||||
return () -> new JmxMeterRegistry(nameMapper, clock);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class PrometheusExportConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "spring.metrics.prometheus.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.metrics.export.prometheus.enabled", matchIfMissing = true)
|
||||
public MetricsExporter prometheusExporter(PrometheusConfig prometheusConfig,
|
||||
CollectorRegistry collectorRegistry, Clock clock) {
|
||||
return () -> new PrometheusMeterRegistry(prometheusConfig, collectorRegistry,
|
||||
|
@ -26,7 +26,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @author Jon Schneider
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.metrics.prometheus")
|
||||
@ConfigurationProperties(prefix = "spring.metrics.export.prometheus")
|
||||
public class PrometheusProperties {
|
||||
|
||||
/**
|
||||
|
@ -37,7 +37,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
public class SimpleExportConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "spring.metrics.simple.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.metrics.export.simple.enabled", matchIfMissing = true)
|
||||
@ConditionalOnMissingBean(MetricsExporter.class)
|
||||
public MetricsExporter simpleExporter(Clock clock) {
|
||||
return () -> new SimpleMeterRegistry(clock);
|
||||
|
@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @author Jon Schneider
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.metrics.simple")
|
||||
@ConfigurationProperties(prefix = "spring.metrics.export.simple")
|
||||
public class SimpleProperties {
|
||||
|
||||
private boolean enabled = true;
|
||||
|
@ -49,7 +49,7 @@ public class StatsdExportConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "spring.metrics.statsd.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.metrics.export.statsd.enabled", matchIfMissing = true)
|
||||
public MetricsExporter statsdExporter(StatsdConfig statsdConfig, Clock clock) {
|
||||
return () -> new StatsdMeterRegistry(statsdConfig, clock);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @author Jon Schneider
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.metrics.statsd")
|
||||
@ConfigurationProperties(prefix = "spring.metrics.export.statsd")
|
||||
public class StatsdProperties {
|
||||
|
||||
/**
|
||||
|
@ -39,14 +39,14 @@ public class SimpleExportConfigurationTests {
|
||||
@Test
|
||||
public void simpleMeterRegistryIsInTheCompositeWhenNoOtherRegistryIs() {
|
||||
new ApplicationContextRunner()
|
||||
.withPropertyValues("spring.metrics.atlas.enabled=false",
|
||||
"spring.metrics.datadog.enabled=false",
|
||||
"spring.metrics.ganglia.enabled=false",
|
||||
"spring.metrics.graphite.enabled=false",
|
||||
"spring.metrics.influx.enabled=false",
|
||||
"spring.metrics.jmx.enabled=false",
|
||||
"spring.metrics.prometheus.enabled=false",
|
||||
"spring.metrics.statsd.enabled=false")
|
||||
.withPropertyValues("spring.metrics.export.atlas.enabled=false",
|
||||
"spring.metrics.export.datadog.enabled=false",
|
||||
"spring.metrics.export.ganglia.enabled=false",
|
||||
"spring.metrics.export.graphite.enabled=false",
|
||||
"spring.metrics.export.influx.enabled=false",
|
||||
"spring.metrics.export.jmx.enabled=false",
|
||||
"spring.metrics.export.prometheus.enabled=false",
|
||||
"spring.metrics.export.statsd.enabled=false")
|
||||
.withConfiguration(AutoConfigurations.of(MetricsAutoConfiguration.class))
|
||||
.run((context) -> {
|
||||
CompositeMeterRegistry meterRegistry = context
|
||||
|
@ -1287,16 +1287,16 @@ content into your application; rather pick only the properties that you need.
|
||||
management.trace.include=request-headers,response-headers,cookies,errors # Items to be included in the trace.
|
||||
|
||||
# METRICS
|
||||
spring.metrics.atlas.enabled=true # Whether not exporting of metrics to Atlas is enabled.
|
||||
spring.metrics.ganglia.enabled=true # Whether not exporting of metrics to Ganglia is enabled.
|
||||
spring.metrics.graphite.enabled=true # Whether not exporting of metrics to Graphite is enabled.
|
||||
spring.metrics.influx.enabled=true # Whether not exporting of metrics to InfluxDB is enabled.
|
||||
spring.metrics.use-global-registry=true # Whether or not auto-configured MeterRegistry implementations should be bound to the global static registry on Metrics
|
||||
spring.metrics.export.atlas.enabled=true # Whether not exporting of metrics to Atlas is enabled.
|
||||
spring.metrics.export.ganglia.enabled=true # Whether not exporting of metrics to Ganglia is enabled.
|
||||
spring.metrics.export.graphite.enabled=true # Whether not exporting of metrics to Graphite is enabled.
|
||||
spring.metrics.export.influx.enabled=true # Whether not exporting of metrics to InfluxDB is enabled.
|
||||
spring.metrics.export.jmx.enabled=true # Whether not exporting of metrics to JMX is enabled.
|
||||
spring.metrics.export.prometheus.enabled=true # Whether not exporting of metrics to Prometheus is enabled.
|
||||
spring.metrics.export.simple.enabled=true # Whether not exporting of metrics to a simple in-memory store is enabled.
|
||||
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.jmx.enabled=true # Whether not exporting of metrics to JMX is enabled.
|
||||
spring.metrics.prometheus.enabled=true # Whether not exporting of metrics to Prometheus is enabled.
|
||||
spring.metrics.simple.enabled=true # Whether not exporting of metrics to a simple in-memory store is enabled.
|
||||
spring.metrics.use-global-registry=true # Whether or not auto-configured MeterRegistry implementations should be bound to the global static registry on Metrics
|
||||
spring.metrics.web.client.record-request-percentiles=false # Whether or not instrumented requests record percentiles histogram buckets by default.
|
||||
spring.metrics.web.client.requests-metric-name=http.client.requests # Name of the metric for sent requests.
|
||||
spring.metrics.web.server.auto-time-requests=true Whether or not requests handled by Spring MVC or WebFlux should be automatically timed.
|
||||
|
Loading…
Reference in New Issue
Block a user