Skip to content

Commit f61a632

Browse files
committed
Polish "Fix conditions that lead to auto-configure PushGateway"
See gh-22919
1 parent c355b95 commit f61a632

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfigurationTests.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -123,6 +123,12 @@ void allowsCustomScrapeEndpointToBeUsed() {
123123
.hasBean("customEndpoint").hasSingleBean(PrometheusScrapeEndpoint.class));
124124
}
125125

126+
@Test
127+
void pushGatewayIsNotConfiguredWhenEnabledFlagIsNotSet() {
128+
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
129+
.run((context) -> assertThat(context).doesNotHaveBean(PrometheusPushGatewayManager.class));
130+
}
131+
126132
@Test
127133
void withPushGatewayEnabled(CapturedOutput output) {
128134
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
@@ -154,12 +160,6 @@ void withCustomPushGatewayURL() {
154160
.run((context) -> hasGatewayURL(context, "https://example.com:8080/metrics/"));
155161
}
156162

157-
@Test
158-
void pushGatewayIsNotConfiguredWhenEnabledFlagIsNotSet() {
159-
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
160-
.run((context) -> assertThat(context).doesNotHaveBean(PrometheusPushGatewayManager.class));
161-
}
162-
163163
private void hasGatewayURL(AssertableApplicationContext context, String url) {
164164
assertThat(context).hasSingleBean(PrometheusPushGatewayManager.class);
165165
PrometheusPushGatewayManager gatewayManager = context.getBean(PrometheusPushGatewayManager.class);

spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1552,12 +1552,14 @@ To enable Prometheus Pushgateway support, add the following dependency to your p
15521552
</dependency>
15531553
----
15541554

1555-
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.
1555+
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.
15561556
This manages the pushing of metrics to a Prometheus Pushgateway.
1557+
15571558
The `PrometheusPushGatewayManager` can be tuned using properties under `management.metrics.export.prometheus.pushgateway`.
15581559
For advanced configuration, you can also provide your own `PrometheusPushGatewayManager` bean.
15591560

15601561

1562+
15611563
[[production-ready-metrics-export-signalfx]]
15621564
==== SignalFx
15631565
SignalFx registry pushes metrics to {micrometer-registry-docs}/signalFx[SignalFx] periodically.

0 commit comments

Comments
 (0)