Commit 70f12163 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge pull request #22919 from smlc

* pr/22919:
  Polish "Fix conditions that lead to auto-configure PushGateway"
  Fix conditions that lead to auto-configure PushGateway

Closes gh-22919
parents 4f65f2e9 f61a632a
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -123,6 +123,12 @@ class PrometheusMetricsExportAutoConfigurationTests {
.hasBean("customEndpoint").hasSingleBean(PrometheusScrapeEndpoint.class));
}
@Test
void pushGatewayIsNotConfiguredWhenEnabledFlagIsNotSet() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.run((context) -> assertThat(context).doesNotHaveBean(PrometheusPushGatewayManager.class));
}
@Test
void withPushGatewayEnabled(CapturedOutput output) {
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
......
......@@ -1552,8 +1552,9 @@ To enable Prometheus Pushgateway support, add the following dependency to your p
</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.
The `PrometheusPushGatewayManager` can be tuned using properties under `management.metrics.export.prometheus.pushgateway`.
For advanced configuration, you can also provide your own `PrometheusPushGatewayManager` bean.
......
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