mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Polish "Auto-config support for latest Prometheus client and simpleclient"
See gh-40023
This commit is contained in:
parent
7f26b67e61
commit
ce358c601b
@ -58,31 +58,31 @@ public class PrometheusMetricsExportAutoConfiguration {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
public PrometheusConfig prometheusConfig(PrometheusProperties prometheusProperties) {
|
PrometheusConfig prometheusConfig(PrometheusProperties prometheusProperties) {
|
||||||
return new PrometheusPropertiesConfigAdapter(prometheusProperties);
|
return new PrometheusPropertiesConfigAdapter(prometheusProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
public PrometheusMeterRegistry prometheusMeterRegistry(PrometheusConfig prometheusConfig,
|
PrometheusMeterRegistry prometheusMeterRegistry(PrometheusConfig prometheusConfig,
|
||||||
PrometheusRegistry prometheusRegistry, Clock clock, ObjectProvider<SpanContext> spanContext) {
|
PrometheusRegistry prometheusRegistry, Clock clock, ObjectProvider<SpanContext> spanContext) {
|
||||||
return new PrometheusMeterRegistry(prometheusConfig, prometheusRegistry, clock, spanContext.getIfAvailable());
|
return new PrometheusMeterRegistry(prometheusConfig, prometheusRegistry, clock, spanContext.getIfAvailable());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
public PrometheusRegistry prometheusRegistry() {
|
PrometheusRegistry prometheusRegistry() {
|
||||||
return new PrometheusRegistry();
|
return new PrometheusRegistry();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@ConditionalOnAvailableEndpoint(endpoint = PrometheusScrapeEndpoint.class)
|
@ConditionalOnAvailableEndpoint(endpoint = PrometheusScrapeEndpoint.class)
|
||||||
public static class PrometheusScrapeEndpointConfiguration {
|
static class PrometheusScrapeEndpointConfiguration {
|
||||||
|
|
||||||
@SuppressWarnings("removal")
|
@SuppressWarnings("removal")
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean({ PrometheusScrapeEndpoint.class, PrometheusSimpleclientScrapeEndpoint.class })
|
@ConditionalOnMissingBean({ PrometheusScrapeEndpoint.class, PrometheusSimpleclientScrapeEndpoint.class })
|
||||||
public PrometheusScrapeEndpoint prometheusEndpoint(PrometheusRegistry prometheusRegistry) {
|
PrometheusScrapeEndpoint prometheusEndpoint(PrometheusRegistry prometheusRegistry) {
|
||||||
return new PrometheusScrapeEndpoint(prometheusRegistry);
|
return new PrometheusScrapeEndpoint(prometheusRegistry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.springframework.boot.actuate.metrics.export.prometheus.PrometheusPushGatewayManager.ShutdownOperation;
|
import org.springframework.boot.actuate.metrics.export.prometheus.PrometheusPushGatewayManager.ShutdownOperation;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link ConfigurationProperties @ConfigurationProperties} for configuring metrics export
|
* {@link ConfigurationProperties @ConfigurationProperties} for configuring metrics export
|
||||||
@ -54,13 +55,13 @@ public class PrometheusProperties {
|
|||||||
/**
|
/**
|
||||||
* Histogram type for backing DistributionSummary and Timer.
|
* Histogram type for backing DistributionSummary and Timer.
|
||||||
*/
|
*/
|
||||||
@Deprecated(since = "3.3.0")
|
@Deprecated(since = "3.3.0", forRemoval = true)
|
||||||
private HistogramFlavor histogramFlavor = HistogramFlavor.Prometheus;
|
private HistogramFlavor histogramFlavor = HistogramFlavor.Prometheus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional properties to pass to the Prometheus client.
|
* Additional properties to pass to the Prometheus client.
|
||||||
*/
|
*/
|
||||||
private final Map<String, String> prometheusProperties = new HashMap<>();
|
private final Map<String, String> properties = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Step size (i.e. reporting frequency) to use.
|
* Step size (i.e. reporting frequency) to use.
|
||||||
@ -75,6 +76,9 @@ public class PrometheusProperties {
|
|||||||
this.descriptions = descriptions;
|
this.descriptions = descriptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated(since = "3.3.0", forRemoval = true)
|
||||||
|
@DeprecatedConfigurationProperty(since = "3.3.0",
|
||||||
|
reason = "No longer supported. Works only when using the Prometheus simpleclient.")
|
||||||
public HistogramFlavor getHistogramFlavor() {
|
public HistogramFlavor getHistogramFlavor() {
|
||||||
return this.histogramFlavor;
|
return this.histogramFlavor;
|
||||||
}
|
}
|
||||||
@ -103,8 +107,8 @@ public class PrometheusProperties {
|
|||||||
return this.pushgateway;
|
return this.pushgateway;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getPrometheusProperties() {
|
public Map<String, String> getProperties() {
|
||||||
return this.prometheusProperties;
|
return this.properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -218,13 +222,16 @@ public class PrometheusProperties {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prometheus Histogram flavor.
|
||||||
|
*
|
||||||
|
* @deprecated since 3.3.0 for removal in 3.5.0
|
||||||
|
*/
|
||||||
|
@Deprecated(since = "3.3.0", forRemoval = true)
|
||||||
public enum HistogramFlavor {
|
public enum HistogramFlavor {
|
||||||
|
|
||||||
Prometheus, VictoriaMetrics;
|
Prometheus, VictoriaMetrics;
|
||||||
|
|
||||||
HistogramFlavor() {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ class PrometheusPropertiesConfigAdapter extends PropertiesConfigAdapter<Promethe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Properties fromPropertiesMap(PrometheusProperties prometheusProperties) {
|
private Properties fromPropertiesMap(PrometheusProperties prometheusProperties) {
|
||||||
Map<String, String> map = prometheusProperties.getPrometheusProperties();
|
Map<String, String> map = prometheusProperties.getProperties();
|
||||||
if (map.isEmpty()) {
|
if (map.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -61,9 +61,9 @@ import org.springframework.util.StringUtils;
|
|||||||
* @author David J. M. Karlsen
|
* @author David J. M. Karlsen
|
||||||
* @author Jonatan Ivanov
|
* @author Jonatan Ivanov
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
* @deprecated in favor of {@link PrometheusMetricsExportAutoConfiguration}
|
* @deprecated since 3.3.0 for removal in 3.5.0 in favor of
|
||||||
|
* {@link PrometheusMetricsExportAutoConfiguration}
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("removal")
|
|
||||||
@Deprecated(since = "3.3.0", forRemoval = true)
|
@Deprecated(since = "3.3.0", forRemoval = true)
|
||||||
@AutoConfiguration(
|
@AutoConfiguration(
|
||||||
before = { CompositeMeterRegistryAutoConfiguration.class, SimpleMetricsExportAutoConfiguration.class },
|
before = { CompositeMeterRegistryAutoConfiguration.class, SimpleMetricsExportAutoConfiguration.class },
|
||||||
@ -76,13 +76,13 @@ public class PrometheusSimpleclientMetricsExportAutoConfiguration {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
public PrometheusConfig simpleclientPrometheusConfig(PrometheusProperties prometheusProperties) {
|
PrometheusConfig simpleclientPrometheusConfig(PrometheusProperties prometheusProperties) {
|
||||||
return new PrometheusSimpleclientPropertiesConfigAdapter(prometheusProperties);
|
return new PrometheusSimpleclientPropertiesConfigAdapter(prometheusProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
public io.micrometer.prometheus.PrometheusMeterRegistry simpleclientPrometheusMeterRegistry(
|
io.micrometer.prometheus.PrometheusMeterRegistry simpleclientPrometheusMeterRegistry(
|
||||||
io.micrometer.prometheus.PrometheusConfig prometheusConfig, CollectorRegistry collectorRegistry,
|
io.micrometer.prometheus.PrometheusConfig prometheusConfig, CollectorRegistry collectorRegistry,
|
||||||
Clock clock, ObjectProvider<ExemplarSampler> exemplarSamplerProvider) {
|
Clock clock, ObjectProvider<ExemplarSampler> exemplarSamplerProvider) {
|
||||||
return new io.micrometer.prometheus.PrometheusMeterRegistry(prometheusConfig, collectorRegistry, clock,
|
return new io.micrometer.prometheus.PrometheusMeterRegistry(prometheusConfig, collectorRegistry, clock,
|
||||||
@ -91,25 +91,25 @@ public class PrometheusSimpleclientMetricsExportAutoConfiguration {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
public CollectorRegistry collectorRegistry() {
|
CollectorRegistry collectorRegistry() {
|
||||||
return new CollectorRegistry(true);
|
return new CollectorRegistry(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean(ExemplarSampler.class)
|
@ConditionalOnMissingBean(ExemplarSampler.class)
|
||||||
@ConditionalOnBean(SpanContextSupplier.class)
|
@ConditionalOnBean(SpanContextSupplier.class)
|
||||||
public DefaultExemplarSampler exemplarSampler(SpanContextSupplier spanContextSupplier) {
|
DefaultExemplarSampler exemplarSampler(SpanContextSupplier spanContextSupplier) {
|
||||||
return new DefaultExemplarSampler(spanContextSupplier);
|
return new DefaultExemplarSampler(spanContextSupplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("removal")
|
@SuppressWarnings("removal")
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@ConditionalOnAvailableEndpoint(endpoint = PrometheusSimpleclientScrapeEndpoint.class)
|
@ConditionalOnAvailableEndpoint(endpoint = PrometheusSimpleclientScrapeEndpoint.class)
|
||||||
public static class PrometheusScrapeEndpointConfiguration {
|
static class PrometheusScrapeEndpointConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean({ PrometheusSimpleclientScrapeEndpoint.class, PrometheusScrapeEndpoint.class })
|
@ConditionalOnMissingBean({ PrometheusSimpleclientScrapeEndpoint.class, PrometheusScrapeEndpoint.class })
|
||||||
public PrometheusSimpleclientScrapeEndpoint prometheusEndpoint(CollectorRegistry collectorRegistry) {
|
PrometheusSimpleclientScrapeEndpoint prometheusEndpoint(CollectorRegistry collectorRegistry) {
|
||||||
return new PrometheusSimpleclientScrapeEndpoint(collectorRegistry);
|
return new PrometheusSimpleclientScrapeEndpoint(collectorRegistry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ public class PrometheusSimpleclientMetricsExportAutoConfiguration {
|
|||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@ConditionalOnClass(PushGateway.class)
|
@ConditionalOnClass(PushGateway.class)
|
||||||
@ConditionalOnProperty(prefix = "management.prometheus.metrics.export.pushgateway", name = "enabled")
|
@ConditionalOnProperty(prefix = "management.prometheus.metrics.export.pushgateway", name = "enabled")
|
||||||
public static class PrometheusPushGatewayConfiguration {
|
static class PrometheusPushGatewayConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The fallback job name. We use 'spring' since there's a history of Prometheus
|
* The fallback job name. We use 'spring' since there's a history of Prometheus
|
||||||
@ -133,7 +133,7 @@ public class PrometheusSimpleclientMetricsExportAutoConfiguration {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
public PrometheusPushGatewayManager prometheusPushGatewayManager(CollectorRegistry collectorRegistry,
|
PrometheusPushGatewayManager prometheusPushGatewayManager(CollectorRegistry collectorRegistry,
|
||||||
PrometheusProperties prometheusProperties, Environment environment) throws MalformedURLException {
|
PrometheusProperties prometheusProperties, Environment environment) throws MalformedURLException {
|
||||||
PrometheusProperties.Pushgateway properties = prometheusProperties.getPushgateway();
|
PrometheusProperties.Pushgateway properties = prometheusProperties.getPushgateway();
|
||||||
Duration pushRate = properties.getPushRate();
|
Duration pushRate = properties.getPushRate();
|
||||||
|
@ -18,7 +18,6 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus
|
|||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
|
||||||
import org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus.PrometheusProperties.HistogramFlavor;
|
|
||||||
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.PropertiesConfigAdapter;
|
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.PropertiesConfigAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,8 +57,7 @@ class PrometheusSimpleclientPropertiesConfigAdapter extends PropertiesConfigAdap
|
|||||||
}
|
}
|
||||||
|
|
||||||
static io.micrometer.prometheus.HistogramFlavor mapToMicrometerHistogramFlavor(PrometheusProperties properties) {
|
static io.micrometer.prometheus.HistogramFlavor mapToMicrometerHistogramFlavor(PrometheusProperties properties) {
|
||||||
HistogramFlavor histogramFlavor = properties.getHistogramFlavor();
|
return switch (properties.getHistogramFlavor()) {
|
||||||
return switch (histogramFlavor) {
|
|
||||||
case Prometheus -> io.micrometer.prometheus.HistogramFlavor.Prometheus;
|
case Prometheus -> io.micrometer.prometheus.HistogramFlavor.Prometheus;
|
||||||
case VictoriaMetrics -> io.micrometer.prometheus.HistogramFlavor.VictoriaMetrics;
|
case VictoriaMetrics -> io.micrometer.prometheus.HistogramFlavor.VictoriaMetrics;
|
||||||
};
|
};
|
||||||
|
@ -37,6 +37,7 @@ import org.springframework.util.function.SingletonSupplier;
|
|||||||
*
|
*
|
||||||
* @author Jonatan Ivanov
|
* @author Jonatan Ivanov
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
* @deprecated since 3.3.0 for removal in 3.5.0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("removal")
|
@SuppressWarnings("removal")
|
||||||
@Deprecated(forRemoval = true, since = "3.3.0")
|
@Deprecated(forRemoval = true, since = "3.3.0")
|
||||||
|
@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
*
|
*
|
||||||
* @author Mirko Sobeck
|
* @author Mirko Sobeck
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "deprecation" })
|
@SuppressWarnings({ "deprecation", "removal" })
|
||||||
class PrometheusSimpleclientPropertiesConfigAdapterTests extends
|
class PrometheusSimpleclientPropertiesConfigAdapterTests extends
|
||||||
AbstractPropertiesConfigAdapterTests<PrometheusProperties, PrometheusSimpleclientPropertiesConfigAdapter> {
|
AbstractPropertiesConfigAdapterTests<PrometheusProperties, PrometheusSimpleclientPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class PrometheusExemplarsAutoConfigurationTests {
|
|||||||
@Test
|
@Test
|
||||||
void prometheusOpenMetricsOutputWithoutExemplarsOnHistogramCount() {
|
void prometheusOpenMetricsOutputWithoutExemplarsOnHistogramCount() {
|
||||||
this.contextRunner.withPropertyValues(
|
this.contextRunner.withPropertyValues(
|
||||||
"management.prometheus.metrics.export.prometheus-properties.io.prometheus.exporter.exemplarsOnAllMetricTypes=false")
|
"management.prometheus.metrics.export.properties.io.prometheus.exporter.exemplarsOnAllMetricTypes=false")
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
assertThat(context).hasSingleBean(SpanContext.class);
|
assertThat(context).hasSingleBean(SpanContext.class);
|
||||||
ObservationRegistry observationRegistry = context.getBean(ObservationRegistry.class);
|
ObservationRegistry observationRegistry = context.getBean(ObservationRegistry.class);
|
||||||
|
@ -35,6 +35,7 @@ import org.springframework.lang.Nullable;
|
|||||||
*
|
*
|
||||||
* @author Jon Schneider
|
* @author Jon Schneider
|
||||||
* @author Johnny Lim
|
* @author Johnny Lim
|
||||||
|
* @author Moritz Halbritter
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
@WebEndpoint(id = "prometheus")
|
@WebEndpoint(id = "prometheus")
|
||||||
@ -51,17 +52,15 @@ public class PrometheusScrapeEndpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ReadOperation(producesFrom = PrometheusOutputFormat.class)
|
@ReadOperation(producesFrom = PrometheusOutputFormat.class)
|
||||||
public WebEndpointResponse<String> scrape(PrometheusOutputFormat format, @Nullable Set<String> includedNames) {
|
public WebEndpointResponse<byte[]> scrape(PrometheusOutputFormat format, @Nullable Set<String> includedNames) {
|
||||||
try {
|
try {
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(this.nextMetricsScrapeSize);
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(this.nextMetricsScrapeSize);
|
||||||
MetricSnapshots metricSnapshots = (includedNames != null)
|
MetricSnapshots metricSnapshots = (includedNames != null)
|
||||||
? this.prometheusRegistry.scrape(includedNames::contains) : this.prometheusRegistry.scrape();
|
? this.prometheusRegistry.scrape(includedNames::contains) : this.prometheusRegistry.scrape();
|
||||||
format.write(outputStream, metricSnapshots);
|
format.write(outputStream, metricSnapshots);
|
||||||
|
byte[] content = outputStream.toByteArray();
|
||||||
String scrapePage = outputStream.toString();
|
this.nextMetricsScrapeSize = content.length + METRICS_SCRAPE_CHARS_EXTRA;
|
||||||
this.nextMetricsScrapeSize = scrapePage.length() + METRICS_SCRAPE_CHARS_EXTRA;
|
return new WebEndpointResponse<>(content, format);
|
||||||
|
|
||||||
return new WebEndpointResponse<>(scrapePage, format);
|
|
||||||
}
|
}
|
||||||
catch (IOException ex) {
|
catch (IOException ex) {
|
||||||
throw new IllegalStateException("Writing metrics failed", ex);
|
throw new IllegalStateException("Writing metrics failed", ex);
|
||||||
|
@ -38,7 +38,8 @@ import org.springframework.lang.Nullable;
|
|||||||
* @author Jon Schneider
|
* @author Jon Schneider
|
||||||
* @author Johnny Lim
|
* @author Johnny Lim
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
* @deprecated in favor of {@link PrometheusScrapeEndpoint}
|
* @deprecated since 3.3.0 for removal in 3.5.0 in favor of
|
||||||
|
* {@link PrometheusScrapeEndpoint}
|
||||||
*/
|
*/
|
||||||
@Deprecated(since = "3.3.0", forRemoval = true)
|
@Deprecated(since = "3.3.0", forRemoval = true)
|
||||||
@WebEndpoint(id = "prometheus")
|
@WebEndpoint(id = "prometheus")
|
||||||
@ -63,10 +64,8 @@ public class PrometheusSimpleclientScrapeEndpoint {
|
|||||||
? this.collectorRegistry.filteredMetricFamilySamples(includedNames)
|
? this.collectorRegistry.filteredMetricFamilySamples(includedNames)
|
||||||
: this.collectorRegistry.metricFamilySamples();
|
: this.collectorRegistry.metricFamilySamples();
|
||||||
format.write(writer, samples);
|
format.write(writer, samples);
|
||||||
|
|
||||||
String scrapePage = writer.toString();
|
String scrapePage = writer.toString();
|
||||||
this.nextMetricsScrapeSize = scrapePage.length() + METRICS_SCRAPE_CHARS_EXTRA;
|
this.nextMetricsScrapeSize = scrapePage.length() + METRICS_SCRAPE_CHARS_EXTRA;
|
||||||
|
|
||||||
return new WebEndpointResponse<>(scrapePage, format);
|
return new WebEndpointResponse<>(scrapePage, format);
|
||||||
}
|
}
|
||||||
catch (IOException ex) {
|
catch (IOException ex) {
|
||||||
|
@ -32,7 +32,7 @@ import org.springframework.util.MimeTypeUtils;
|
|||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
* @deprecated in favor of {@link PrometheusOutputFormat}
|
* @deprecated since 3.3.0 for removal in 3.5.0 in favor of {@link PrometheusOutputFormat}
|
||||||
*/
|
*/
|
||||||
@Deprecated(since = "3.3.0", forRemoval = true)
|
@Deprecated(since = "3.3.0", forRemoval = true)
|
||||||
public enum TextOutputFormat implements Producible<TextOutputFormat> {
|
public enum TextOutputFormat implements Producible<TextOutputFormat> {
|
||||||
|
@ -543,11 +543,13 @@ scrape_configs:
|
|||||||
----
|
----
|
||||||
|
|
||||||
https://prometheus.io/docs/prometheus/latest/feature_flags/#exemplars-storage[Prometheus Exemplars] are also supported.
|
https://prometheus.io/docs/prometheus/latest/feature_flags/#exemplars-storage[Prometheus Exemplars] are also supported.
|
||||||
To enable this feature, a `SpanContextSupplier` bean should be present.
|
To enable this feature, a `SpanContext` bean should be present.
|
||||||
|
If you're using the deprecated Prometheus simpleclient support and want to enable that feature, a `SpanContextSupplier` bean should be present.
|
||||||
If you use https://micrometer.io/docs/tracing[Micrometer Tracing], this will be auto-configured for you, but you can always create your own if you want.
|
If you use https://micrometer.io/docs/tracing[Micrometer Tracing], this will be auto-configured for you, but you can always create your own if you want.
|
||||||
Please check the https://prometheus.io/docs/prometheus/latest/feature_flags/#exemplars-storage[Prometheus Docs], since this feature needs to be explicitly enabled on Prometheus' side, and it is only supported using the https://github.com/OpenObservability/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#exemplars[OpenMetrics] format.
|
Please check the https://prometheus.io/docs/prometheus/latest/feature_flags/#exemplars-storage[Prometheus Docs], since this feature needs to be explicitly enabled on Prometheus' side, and it is only supported using the https://github.com/OpenObservability/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#exemplars[OpenMetrics] format.
|
||||||
|
|
||||||
For ephemeral or batch jobs that may not exist long enough to be scraped, you can use https://github.com/prometheus/pushgateway[Prometheus Pushgateway] support to expose the metrics to Prometheus.
|
For ephemeral or batch jobs that may not exist long enough to be scraped, you can use https://github.com/prometheus/pushgateway[Prometheus Pushgateway] support to expose the metrics to Prometheus.
|
||||||
|
The Prometheus Pushgateway only works with the deprecated Prometheus simpleclient for now, until the Prometheus client 1.x adds support for it.
|
||||||
To enable Prometheus Pushgateway support, add the following dependency to your project:
|
To enable Prometheus Pushgateway support, add the following dependency to your project:
|
||||||
|
|
||||||
[source,xml]
|
[source,xml]
|
||||||
|
Loading…
Reference in New Issue
Block a user