Commit c355b95f authored by smlc's avatar smlc Committed by Stephane Nicoll

Fix conditions that lead to auto-configure PushGateway

See gh-22919
parent 4f65f2e9
...@@ -154,6 +154,12 @@ class PrometheusMetricsExportAutoConfigurationTests { ...@@ -154,6 +154,12 @@ class PrometheusMetricsExportAutoConfigurationTests {
.run((context) -> hasGatewayURL(context, "https://example.com:8080/metrics/")); .run((context) -> hasGatewayURL(context, "https://example.com:8080/metrics/"));
} }
@Test
void pushGatewayIsNotConfiguredWhenEnabledFlagIsNotSet() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.run((context) -> assertThat(context).doesNotHaveBean(PrometheusPushGatewayManager.class));
}
private void hasGatewayURL(AssertableApplicationContext context, String url) { private void hasGatewayURL(AssertableApplicationContext context, String url) {
assertThat(context).hasSingleBean(PrometheusPushGatewayManager.class); assertThat(context).hasSingleBean(PrometheusPushGatewayManager.class);
PrometheusPushGatewayManager gatewayManager = context.getBean(PrometheusPushGatewayManager.class); PrometheusPushGatewayManager gatewayManager = context.getBean(PrometheusPushGatewayManager.class);
......
...@@ -1552,13 +1552,12 @@ To enable Prometheus Pushgateway support, add the following dependency to your p ...@@ -1552,13 +1552,12 @@ To enable Prometheus Pushgateway support, add the following dependency to your p
</dependency> </dependency>
---- ----
When the Prometheus Pushgateway dependency is present on the classpath, Spring Boot auto-configures a `PrometheusPushGatewayManager` bean. When the Prometheus Pushgateway dependency is present on the classpath and the `configprop:management.metrics.export.prometheus.pushgateway.enabled` property is set to true, a PrometheusPushGatewayManager bean is auto-configured.
This manages the pushing of metrics to a Prometheus Pushgateway. This manages the pushing of metrics to a Prometheus Pushgateway.
The `PrometheusPushGatewayManager` can be tuned using properties under `management.metrics.export.prometheus.pushgateway`. The `PrometheusPushGatewayManager` can be tuned using properties under `management.metrics.export.prometheus.pushgateway`.
For advanced configuration, you can also provide your own `PrometheusPushGatewayManager` bean. For advanced configuration, you can also provide your own `PrometheusPushGatewayManager` bean.
[[production-ready-metrics-export-signalfx]] [[production-ready-metrics-export-signalfx]]
==== SignalFx ==== SignalFx
SignalFx registry pushes metrics to {micrometer-registry-docs}/signalFx[SignalFx] periodically. SignalFx registry pushes metrics to {micrometer-registry-docs}/signalFx[SignalFx] periodically.
......
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