Move metric properties

- Moved from 'management.metrics.export.<product>' to
  'management.<product>.metrics.export'
- The default enabled property moved from 'management.metrics.export.defaults.enabled'
  to 'management.defaults.metrics.export.enabled'

Closes gh-30381
pull/30456/head
Moritz Halbritter 3 years ago
parent 3af3b26f8e
commit be3523b1cd

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -26,9 +26,9 @@ import org.springframework.context.annotation.Conditional;
/**
* {@link Conditional @Conditional} that checks whether or not a metrics exporter is
* enabled. If the {@code management.metrics.export.<name>.enabled} property is configured
* enabled. If the {@code management.<name>.metrics.export.enabled} property is configured
* then its value is used to determine if it matches. Otherwise, matches if the value of
* the {@code management.metrics.export.defaults.enabled} property is {@code true} or if
* the {@code management.defaults.metrics.export.enabled} property is {@code true} or if
* it is not configured.
*
* @author Chris Bono

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -16,18 +16,61 @@
package org.springframework.boot.actuate.autoconfigure.metrics.export;
import org.springframework.boot.actuate.autoconfigure.OnEndpointElementCondition;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;
/**
* {@link Condition} that checks if a metrics exporter is enabled.
*
* @author Chris Bono
* @author Moritz Halbritter
*/
class OnMetricsExportEnabledCondition extends OnEndpointElementCondition {
class OnMetricsExportEnabledCondition extends SpringBootCondition {
protected OnMetricsExportEnabledCondition() {
super("management.metrics.export.", ConditionalOnEnabledMetricsExport.class);
private static final String PROPERTY_TEMPLATE = "management.%s.metrics.export.enabled";
private static final String DEFAULT_PROPERTY_NAME = "management.defaults.metrics.export.enabled";
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
AnnotationAttributes annotationAttributes = AnnotationAttributes
.fromMap(metadata.getAnnotationAttributes(ConditionalOnEnabledMetricsExport.class.getName()));
String endpointName = annotationAttributes.getString("value");
ConditionOutcome outcome = getProductOutcome(context, endpointName);
if (outcome != null) {
return outcome;
}
return getDefaultOutcome(context);
}
private ConditionOutcome getProductOutcome(ConditionContext context, String productName) {
Environment environment = context.getEnvironment();
String enabledProperty = PROPERTY_TEMPLATE.formatted(productName);
if (environment.containsProperty(enabledProperty)) {
boolean match = environment.getProperty(enabledProperty, Boolean.class, true);
return new ConditionOutcome(match, ConditionMessage.forCondition(ConditionalOnEnabledMetricsExport.class)
.because(enabledProperty + " is " + match));
}
return null;
}
/**
* Return the default outcome that should be used if property is not set. By default
* this method will use the {@link #DEFAULT_PROPERTY_NAME} property, matching if it is
* {@code true} or if it is not configured.
* @param context the condition context
* @return the default outcome
*/
private ConditionOutcome getDefaultOutcome(ConditionContext context) {
boolean match = Boolean.parseBoolean(context.getEnvironment().getProperty(DEFAULT_PROPERTY_NAME, "true"));
return new ConditionOutcome(match, ConditionMessage.forCondition(ConditionalOnEnabledMetricsExport.class)
.because(DEFAULT_PROPERTY_NAME + " is considered " + match));
}
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -28,7 +28,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll
* @since 2.1.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.appoptics")
@ConfigurationProperties(prefix = "management.appoptics.metrics.export")
public class AppOpticsProperties extends StepRegistryProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -34,7 +34,7 @@ class AppOpticsPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapt
@Override
public String prefix() {
return "management.metrics.export.appoptics";
return "management.appoptics.metrics.export";
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -28,7 +28,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll
* @since 2.0.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.atlas")
@ConfigurationProperties(prefix = "management.atlas.metrics.export")
public class AtlasProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll
* @since 2.0.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.datadog")
@ConfigurationProperties(prefix = "management.datadog.metrics.export")
public class DatadogProperties extends StepRegistryProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -35,7 +35,7 @@ class DatadogPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter
@Override
public String prefix() {
return "management.metrics.export.datadog";
return "management.datadog.metrics.export";
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@ -30,7 +30,7 @@ import org.springframework.boot.context.properties.DeprecatedConfigurationProper
* @author Georg Pirklbauer
* @since 2.1.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.dynatrace")
@ConfigurationProperties(prefix = "management.dynatrace.metrics.export")
public class DynatraceProperties extends StepRegistryProperties {
private final V1 v1 = new V1();
@ -57,7 +57,7 @@ public class DynatraceProperties extends StepRegistryProperties {
}
@Deprecated
@DeprecatedConfigurationProperty(replacement = "management.metrics.export.dynatrace.v1.device-id")
@DeprecatedConfigurationProperty(replacement = "management.dynatrace.metrics.export.v1.device-id")
public String getDeviceId() {
return this.v1.getDeviceId();
}
@ -68,7 +68,7 @@ public class DynatraceProperties extends StepRegistryProperties {
}
@Deprecated
@DeprecatedConfigurationProperty(replacement = "management.metrics.export.dynatrace.v1.technology-type")
@DeprecatedConfigurationProperty(replacement = "management.dynatrace.metrics.export.v1.technology-type")
public String getTechnologyType() {
return this.v1.getTechnologyType();
}
@ -87,7 +87,7 @@ public class DynatraceProperties extends StepRegistryProperties {
}
@Deprecated
@DeprecatedConfigurationProperty(replacement = "management.metrics.export.dynatrace.v1.group")
@DeprecatedConfigurationProperty(replacement = "management.dynatrace.metrics.export.v1.group")
public String getGroup() {
return this.v1.getGroup();
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@ -41,7 +41,7 @@ class DynatracePropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapt
@Override
public String prefix() {
return "management.metrics.export.dynatrace";
return "management.dynatrace.metrics.export";
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@ -26,7 +26,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Andy Wilkinson
* @since 2.1.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.elastic")
@ConfigurationProperties(prefix = "management.elastic.metrics.export")
public class ElasticProperties extends StepRegistryProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@ -34,7 +34,7 @@ class ElasticPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter
@Override
public String prefix() {
return "management.metrics.export.elastic";
return "management.elastic.metrics.export";
}
@Override

@ -31,7 +31,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll
* @since 2.0.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.ganglia")
@ConfigurationProperties(prefix = "management.ganglia.metrics.export")
public class GangliaProperties {
/**

@ -38,7 +38,7 @@ class GangliaPropertiesConfigAdapter extends PropertiesConfigAdapter<GangliaProp
@Override
public String prefix() {
return "management.metrics.export.ganglia";
return "management.ganglia.metrics.export";
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -32,7 +32,7 @@ import org.springframework.util.ObjectUtils;
* @author Stephane Nicoll
* @since 2.0.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.graphite")
@ConfigurationProperties(prefix = "management.graphite.metrics.export")
public class GraphiteProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -38,7 +38,7 @@ class GraphitePropertiesConfigAdapter extends PropertiesConfigAdapter<GraphitePr
@Override
public String prefix() {
return "management.metrics.export.graphite";
return "management.graphite.metrics.export";
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -30,7 +30,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Andy Wilkinson
* @since 2.1.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.humio")
@ConfigurationProperties(prefix = "management.humio.metrics.export")
public class HumioProperties extends StepRegistryProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -35,7 +35,7 @@ class HumioPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter<H
@Override
public String prefix() {
return "management.metrics.export.humio";
return "management.humio.metrics.export";
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@ -30,7 +30,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll
* @since 2.0.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.influx")
@ConfigurationProperties(prefix = "management.influx.metrics.export")
public class InfluxProperties extends StepRegistryProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@ -37,7 +37,7 @@ class InfluxPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter<
@Override
public String prefix() {
return "management.metrics.export.influx";
return "management.influx.metrics.export";
}
@Override

@ -28,7 +28,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll
* @since 2.0.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.jmx")
@ConfigurationProperties(prefix = "management.jmx.metrics.export")
public class JmxProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -36,7 +36,7 @@ class JmxPropertiesConfigAdapter extends PropertiesConfigAdapter<JmxProperties>
@Override
public String prefix() {
return "management.metrics.export.jmx";
return "management.jmx.metrics.export";
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 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.
@ -26,7 +26,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll
* @since 2.1.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.kairos")
@ConfigurationProperties(prefix = "management.kairos.metrics.export")
public class KairosProperties extends StepRegistryProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -34,7 +34,7 @@ class KairosPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter<
@Override
public String prefix() {
return "management.metrics.export.kairos";
return "management.kairos.metrics.export";
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -31,7 +31,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Neil Powell
* @since 2.0.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.newrelic")
@ConfigurationProperties(prefix = "management.newrelic.metrics.export")
public class NewRelicProperties extends StepRegistryProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -37,7 +37,7 @@ public class NewRelicPropertiesConfigAdapter extends StepRegistryPropertiesConfi
@Override
public String prefix() {
return "management.metrics.export.newrelic";
return "management.newrelic.metrics.export";
}
@Override

@ -104,7 +104,7 @@ public class PrometheusMetricsExportAutoConfiguration {
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(PushGateway.class)
@ConditionalOnProperty(prefix = "management.metrics.export.prometheus.pushgateway", name = "enabled")
@ConditionalOnProperty(prefix = "management.prometheus.metrics.export.pushgateway", name = "enabled")
public static class PrometheusPushGatewayConfiguration {
private static final Log logger = LogFactory.getLog(PrometheusPushGatewayConfiguration.class);

@ -33,7 +33,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll
* @since 2.0.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.prometheus")
@ConfigurationProperties(prefix = "management.prometheus.metrics.export")
public class PrometheusProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -38,7 +38,7 @@ class PrometheusPropertiesConfigAdapter extends PropertiesConfigAdapter<Promethe
@Override
public String prefix() {
return "management.metrics.export.prometheus";
return "management.prometheus.metrics.export";
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 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.
@ -30,7 +30,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll
* @since 2.0.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.signalfx")
@ConfigurationProperties(prefix = "management.signalfx.metrics.export")
public class SignalFxProperties extends StepRegistryProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -36,7 +36,7 @@ public class SignalFxPropertiesConfigAdapter extends StepRegistryPropertiesConfi
@Override
public String prefix() {
return "management.metrics.export.signalfx";
return "management.signalfx.metrics.export";
}
@Override

@ -31,7 +31,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll
* @since 2.0.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.simple")
@ConfigurationProperties(prefix = "management.simple.metrics.export")
public class SimpleProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -37,7 +37,7 @@ public class SimplePropertiesConfigAdapter extends PropertiesConfigAdapter<Simpl
@Override
public String prefix() {
return "management.metrics.export.simple";
return "management.simple.metrics.export";
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll
* @since 2.3.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.stackdriver")
@ConfigurationProperties(prefix = "management.stackdriver.metrics.export")
public class StackdriverProperties extends StepRegistryProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@ -37,7 +37,7 @@ public class StackdriverPropertiesConfigAdapter extends StepRegistryPropertiesCo
@Override
public String prefix() {
return "management.metrics.export.stackdriver";
return "management.stackdriver.metrics.export";
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -31,7 +31,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll
* @since 2.0.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.statsd")
@ConfigurationProperties(prefix = "management.statsd.metrics.export")
public class StatsdProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -43,7 +43,7 @@ public class StatsdPropertiesConfigAdapter extends PropertiesConfigAdapter<Stats
@Override
public String prefix() {
return "management.metrics.export.statsd";
return "management.statsd.metrics.export";
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -31,7 +31,7 @@ import org.springframework.util.unit.DataSize;
* @author Stephane Nicoll
* @since 2.0.0
*/
@ConfigurationProperties("management.metrics.export.wavefront")
@ConfigurationProperties("management.wavefront.metrics.export")
public class WavefrontProperties extends PushRegistryProperties {
/**

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -35,7 +35,7 @@ public class WavefrontPropertiesConfigAdapter extends PushRegistryPropertiesConf
@Override
public String prefix() {
return "management.metrics.export.wavefront";
return "management.wavefront.metrics.export";
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -44,10 +44,10 @@ class ValidationFailureAnalyzerTests {
FailureAnalysis analysis = new ValidationFailureAnalyzer()
.analyze(createFailure(MissingAccountIdAndApiKeyConfiguration.class));
assertThat(analysis).isNotNull();
assertThat(analysis.getCause().getMessage()).contains("management.metrics.export.newrelic.apiKey was 'null'");
assertThat(analysis.getCause().getMessage()).contains("management.newrelic.metrics.export.apiKey was 'null'");
assertThat(analysis.getDescription()).isEqualTo(String.format("Invalid Micrometer configuration detected:%n%n"
+ " - management.metrics.export.newrelic.apiKey was 'null' but it is required when publishing to Insights API%n"
+ " - management.metrics.export.newrelic.accountId was 'null' but it is required when publishing to Insights API"));
+ " - management.newrelic.metrics.export.apiKey was 'null' but it is required when publishing to Insights API%n"
+ " - management.newrelic.metrics.export.accountId was 'null' but it is required when publishing to Insights API"));
}
private Exception createFailure(Class<?> configuration) {

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@ -39,21 +39,21 @@ class ConditionalOnEnabledMetricsExportAutoConfigurationTests {
@Test
void exporterCanBeSpecificallyDisabled() {
this.contextRunner.withPropertyValues("management.metrics.export.simple.enabled=false")
this.contextRunner.withPropertyValues("management.simple.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean("simpleMeterRegistry"));
}
@Test
void exporterCanBeGloballyDisabled() {
this.contextRunner.withPropertyValues("management.metrics.export.defaults.enabled=false")
this.contextRunner.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean("simpleMeterRegistry"));
}
@Test
void exporterCanBeGloballyDisabledWithSpecificOverride() {
this.contextRunner
.withPropertyValues("management.metrics.export.defaults.enabled=false",
"management.metrics.export.simple.enabled=true")
.withPropertyValues("management.defaults.metrics.export.enabled=false",
"management.simple.metrics.export.enabled=true")
.run((context) -> assertThat(context).hasBean("simpleMeterRegistry"));
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -46,7 +46,7 @@ class AppOpticsMetricsExportAutoConfigurationTests {
@Test
void autoConfiguresItsConfigAndMeterRegistry() {
this.contextRunner.withPropertyValues("management.metrics.export.appoptics.api-token=abcde")
this.contextRunner.withPropertyValues("management.appoptics.metrics.export.api-token=abcde")
.withUserConfiguration(BaseConfiguration.class).run((context) -> assertThat(context)
.hasSingleBean(AppOpticsMeterRegistry.class).hasSingleBean(AppOpticsConfig.class));
}
@ -54,7 +54,7 @@ class AppOpticsMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(AppOpticsMeterRegistry.class)
.doesNotHaveBean(AppOpticsConfig.class));
}
@ -62,7 +62,7 @@ class AppOpticsMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.appoptics.enabled=false")
.withPropertyValues("management.appoptics.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(AppOpticsMeterRegistry.class)
.doesNotHaveBean(AppOpticsConfig.class));
}
@ -76,7 +76,7 @@ class AppOpticsMetricsExportAutoConfigurationTests {
@Test
void allowsCustomRegistryToBeUsed() {
this.contextRunner.withPropertyValues("management.metrics.export.appoptics.api-token=abcde")
this.contextRunner.withPropertyValues("management.appoptics.metrics.export.api-token=abcde")
.withUserConfiguration(CustomRegistryConfiguration.class)
.run((context) -> assertThat(context).hasSingleBean(AppOpticsMeterRegistry.class)
.hasBean("customRegistry").hasSingleBean(AppOpticsConfig.class));
@ -84,7 +84,7 @@ class AppOpticsMetricsExportAutoConfigurationTests {
@Test
void stopsMeterRegistryWhenContextIsClosed() {
this.contextRunner.withPropertyValues("management.metrics.export.appoptics.api-token=abcde")
this.contextRunner.withPropertyValues("management.appoptics.metrics.export.api-token=abcde")
.withUserConfiguration(BaseConfiguration.class).run((context) -> {
AppOpticsMeterRegistry registry = context.getBean(AppOpticsMeterRegistry.class);
assertThat(registry.isClosed()).isFalse();

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -53,7 +53,7 @@ class AtlasMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(AtlasMeterRegistry.class)
.doesNotHaveBean(AtlasConfig.class));
}
@ -61,7 +61,7 @@ class AtlasMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.atlas.enabled=false")
.withPropertyValues("management.atlas.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(AtlasMeterRegistry.class)
.doesNotHaveBean(AtlasConfig.class));
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -53,7 +53,7 @@ class DatadogMetricsExportAutoConfigurationTests {
@Test
void autoConfiguresConfigAndMeterRegistry() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.datadog.api-key=abcde")
.withPropertyValues("management.datadog.metrics.export.api-key=abcde")
.run((context) -> assertThat(context).hasSingleBean(DatadogMeterRegistry.class)
.hasSingleBean(DatadogConfig.class));
}
@ -61,7 +61,7 @@ class DatadogMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(DatadogMeterRegistry.class)
.doesNotHaveBean(DatadogConfig.class));
}
@ -69,7 +69,7 @@ class DatadogMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.datadog.enabled=false")
.withPropertyValues("management.datadog.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(DatadogMeterRegistry.class)
.doesNotHaveBean(DatadogConfig.class));
}
@ -83,7 +83,7 @@ class DatadogMetricsExportAutoConfigurationTests {
@Test
void allowsCustomRegistryToBeUsed() {
this.contextRunner.withUserConfiguration(CustomRegistryConfiguration.class)
.withPropertyValues("management.metrics.export.datadog.api-key=abcde")
.withPropertyValues("management.datadog.metrics.export.api-key=abcde")
.run((context) -> assertThat(context).hasSingleBean(DatadogMeterRegistry.class)
.hasBean("customRegistry").hasSingleBean(DatadogConfig.class));
}
@ -91,7 +91,7 @@ class DatadogMetricsExportAutoConfigurationTests {
@Test
void stopsMeterRegistryWhenContextIsClosed() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.datadog.api-key=abcde").run((context) -> {
.withPropertyValues("management.datadog.metrics.export.api-key=abcde").run((context) -> {
DatadogMeterRegistry registry = context.getBean(DatadogMeterRegistry.class);
assertThat(registry.isClosed()).isFalse();
context.close();

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@ -50,7 +50,7 @@ class DynatraceMetricsExportAutoConfigurationTests {
@Test
void failsWithADeviceIdWithoutAUri() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.dynatrace.device-id:dev-1")
.withPropertyValues("management.dynatrace.metrics.export.device-id:dev-1")
.run((context) -> assertThat(context).hasFailed());
}
@ -64,7 +64,7 @@ class DynatraceMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(DynatraceMeterRegistry.class)
.doesNotHaveBean(DynatraceConfig.class));
}
@ -72,7 +72,7 @@ class DynatraceMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.dynatrace.enabled=false")
.withPropertyValues("management.dynatrace.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(DynatraceMeterRegistry.class)
.doesNotHaveBean(DynatraceConfig.class));
}
@ -114,9 +114,9 @@ class DynatraceMetricsExportAutoConfigurationTests {
private Function<ApplicationContextRunner, ApplicationContextRunner> v1MandatoryProperties() {
return (runner) -> runner.withPropertyValues(
"management.metrics.export.dynatrace.uri=https://dynatrace.example.com",
"management.metrics.export.dynatrace.api-token=abcde",
"management.metrics.export.dynatrace.device-id=test");
"management.dynatrace.metrics.export.uri=https://dynatrace.example.com",
"management.dynatrace.metrics.export.api-token=abcde",
"management.dynatrace.metrics.export.device-id=test");
}
@Configuration(proxyBeanMethods = false)

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@ -54,7 +54,7 @@ class ElasticMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(ElasticMeterRegistry.class)
.doesNotHaveBean(ElasticConfig.class));
}
@ -62,7 +62,7 @@ class ElasticMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.elastic.enabled=false")
.withPropertyValues("management.elastic.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(ElasticMeterRegistry.class)
.doesNotHaveBean(ElasticConfig.class));
}
@ -94,8 +94,8 @@ class ElasticMetricsExportAutoConfigurationTests {
@Test
void apiKeyCredentialsIsMutuallyExclusiveWithUserName() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.elastic.api-key-credentials:secret",
"management.metrics.export.elastic.user-name:alice")
.withPropertyValues("management.elastic.metrics.export.api-key-credentials:secret",
"management.elastic.metrics.export.user-name:alice")
.run((context) -> assertThat(context).hasFailed().getFailure().getRootCause()
.isInstanceOf(MutuallyExclusiveConfigurationPropertiesException.class));
}
@ -103,8 +103,8 @@ class ElasticMetricsExportAutoConfigurationTests {
@Test
void apiKeyCredentialsIsMutuallyExclusiveWithPassword() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.elastic.api-key-credentials:secret",
"management.metrics.export.elastic.password:secret")
.withPropertyValues("management.elastic.metrics.export.api-key-credentials:secret",
"management.elastic.metrics.export.password:secret")
.run((context) -> assertThat(context).hasFailed().getFailure().getRootCause()
.isInstanceOf(MutuallyExclusiveConfigurationPropertiesException.class));
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -53,7 +53,7 @@ class GangliaMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(GangliaMeterRegistry.class)
.doesNotHaveBean(GangliaConfig.class));
}
@ -61,7 +61,7 @@ class GangliaMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.ganglia.enabled=false")
.withPropertyValues("management.ganglia.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(GangliaMeterRegistry.class)
.doesNotHaveBean(GangliaConfig.class));
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -49,7 +49,7 @@ class GraphiteMetricsExportAutoConfigurationTests {
@Test
void autoConfiguresUseTagsAsPrefix() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.graphite.tags-as-prefix=app").run((context) -> {
.withPropertyValues("management.graphite.metrics.export.tags-as-prefix=app").run((context) -> {
assertThat(context).hasSingleBean(GraphiteMeterRegistry.class);
GraphiteMeterRegistry registry = context.getBean(GraphiteMeterRegistry.class);
registry.counter("test.count", Tags.of("app", "myapp"));
@ -60,8 +60,8 @@ class GraphiteMetricsExportAutoConfigurationTests {
@Test
void autoConfiguresWithTagsAsPrefixCanBeDisabled() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.graphite.tags-as-prefix=app",
"management.metrics.export.graphite.graphite-tags-enabled=true")
.withPropertyValues("management.graphite.metrics.export.tags-as-prefix=app",
"management.graphite.metrics.export.graphite-tags-enabled=true")
.run((context) -> {
assertThat(context).hasSingleBean(GraphiteMeterRegistry.class);
GraphiteMeterRegistry registry = context.getBean(GraphiteMeterRegistry.class);
@ -79,7 +79,7 @@ class GraphiteMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(GraphiteMeterRegistry.class)
.doesNotHaveBean(GraphiteConfig.class));
}
@ -87,7 +87,7 @@ class GraphiteMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.graphite.enabled=false")
.withPropertyValues("management.graphite.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(GraphiteMeterRegistry.class)
.doesNotHaveBean(GraphiteConfig.class));
}

@ -54,7 +54,7 @@ class HumioMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(HumioMeterRegistry.class)
.doesNotHaveBean(HumioConfig.class));
}
@ -62,7 +62,7 @@ class HumioMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.humio.enabled=false")
.withPropertyValues("management.humio.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(HumioMeterRegistry.class)
.doesNotHaveBean(HumioConfig.class));
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -53,7 +53,7 @@ class InfluxMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(InfluxMeterRegistry.class)
.doesNotHaveBean(InfluxConfig.class));
}
@ -61,7 +61,7 @@ class InfluxMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.influx.enabled=false")
.withPropertyValues("management.influx.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(InfluxMeterRegistry.class)
.doesNotHaveBean(InfluxConfig.class));
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -53,7 +53,7 @@ class JmxMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(JmxMeterRegistry.class)
.doesNotHaveBean(JmxConfig.class));
}
@ -61,7 +61,7 @@ class JmxMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.jmx.enabled=false").run((context) -> assertThat(context)
.withPropertyValues("management.jmx.metrics.export.enabled=false").run((context) -> assertThat(context)
.doesNotHaveBean(JmxMeterRegistry.class).doesNotHaveBean(JmxConfig.class));
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -53,7 +53,7 @@ class KairosMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(KairosMeterRegistry.class)
.doesNotHaveBean(KairosConfig.class));
}
@ -61,7 +61,7 @@ class KairosMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.kairos.enabled=false")
.withPropertyValues("management.kairos.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(KairosMeterRegistry.class)
.doesNotHaveBean(KairosConfig.class));
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -51,32 +51,32 @@ class NewRelicMetricsExportAutoConfigurationTests {
@Test
void failsWithoutAnApiKey() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.newrelic.account-id=12345")
.withPropertyValues("management.newrelic.metrics.export.account-id=12345")
.run((context) -> assertThat(context).hasFailed());
}
@Test
void failsWithoutAnAccountId() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde")
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde")
.run((context) -> assertThat(context).hasFailed());
}
@Test
void failsToAutoConfigureWithoutEventType() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
"management.metrics.export.newrelic.account-id=12345",
"management.metrics.export.newrelic.event-type=")
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
"management.newrelic.metrics.export.account-id=12345",
"management.newrelic.metrics.export.event-type=")
.run((context) -> assertThat(context).hasFailed());
}
@Test
void autoConfiguresWithEventTypeOverridden() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
"management.metrics.export.newrelic.account-id=12345",
"management.metrics.export.newrelic.event-type=wxyz")
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
"management.newrelic.metrics.export.account-id=12345",
"management.newrelic.metrics.export.event-type=wxyz")
.run((context) -> assertThat(context).hasSingleBean(NewRelicMeterRegistry.class)
.hasSingleBean(Clock.class).hasSingleBean(NewRelicConfig.class));
}
@ -84,10 +84,10 @@ class NewRelicMetricsExportAutoConfigurationTests {
@Test
void autoConfiguresWithMeterNameEventTypeEnabledAndWithoutEventType() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
"management.metrics.export.newrelic.account-id=12345",
"management.metrics.export.newrelic.event-type=",
"management.metrics.export.newrelic.meter-name-event-type-enabled=true")
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
"management.newrelic.metrics.export.account-id=12345",
"management.newrelic.metrics.export.event-type=",
"management.newrelic.metrics.export.meter-name-event-type-enabled=true")
.run((context) -> assertThat(context).hasSingleBean(NewRelicMeterRegistry.class)
.hasSingleBean(Clock.class).hasSingleBean(NewRelicConfig.class));
}
@ -95,8 +95,8 @@ class NewRelicMetricsExportAutoConfigurationTests {
@Test
void autoConfiguresWithAccountIdAndApiKey() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
"management.metrics.export.newrelic.account-id=12345")
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
"management.newrelic.metrics.export.account-id=12345")
.run((context) -> assertThat(context).hasSingleBean(NewRelicMeterRegistry.class)
.hasSingleBean(Clock.class).hasSingleBean(NewRelicConfig.class));
}
@ -104,7 +104,7 @@ class NewRelicMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(NewRelicMeterRegistry.class)
.doesNotHaveBean(NewRelicConfig.class));
}
@ -112,7 +112,7 @@ class NewRelicMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.newrelic.enabled=false")
.withPropertyValues("management.newrelic.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(NewRelicMeterRegistry.class)
.doesNotHaveBean(NewRelicConfig.class));
}
@ -120,16 +120,16 @@ class NewRelicMetricsExportAutoConfigurationTests {
@Test
void allowsConfigToBeCustomized() {
this.contextRunner.withUserConfiguration(CustomConfigConfiguration.class)
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
"management.metrics.export.newrelic.account-id=12345")
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
"management.newrelic.metrics.export.account-id=12345")
.run((context) -> assertThat(context).hasSingleBean(NewRelicConfig.class).hasBean("customConfig"));
}
@Test
void allowsRegistryToBeCustomized() {
this.contextRunner.withUserConfiguration(CustomRegistryConfiguration.class)
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
"management.metrics.export.newrelic.account-id=12345")
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
"management.newrelic.metrics.export.account-id=12345")
.run((context) -> assertThat(context).hasSingleBean(NewRelicMeterRegistry.class)
.hasBean("customRegistry"));
}
@ -137,8 +137,8 @@ class NewRelicMetricsExportAutoConfigurationTests {
@Test
void allowsClientProviderToBeCustomized() {
this.contextRunner.withUserConfiguration(CustomClientProviderConfiguration.class)
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
"management.metrics.export.newrelic.account-id=12345")
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
"management.newrelic.metrics.export.account-id=12345")
.run((context) -> {
assertThat(context).hasSingleBean(NewRelicMeterRegistry.class);
assertThat(context.getBean(NewRelicMeterRegistry.class))
@ -149,8 +149,8 @@ class NewRelicMetricsExportAutoConfigurationTests {
@Test
void stopsMeterRegistryWhenContextIsClosed() {
this.contextRunner
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
"management.metrics.export.newrelic.account-id=abcde")
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
"management.newrelic.metrics.export.account-id=abcde")
.withUserConfiguration(BaseConfiguration.class).run((context) -> {
NewRelicMeterRegistry registry = context.getBean(NewRelicMeterRegistry.class);
assertThat(registry.isClosed()).isFalse();

@ -71,7 +71,7 @@ class PrometheusMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(PrometheusMeterRegistry.class)
.doesNotHaveBean(CollectorRegistry.class).doesNotHaveBean(PrometheusConfig.class));
}
@ -79,7 +79,7 @@ class PrometheusMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.prometheus.enabled=false")
.withPropertyValues("management.prometheus.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(PrometheusMeterRegistry.class)
.doesNotHaveBean(CollectorRegistry.class).doesNotHaveBean(PrometheusConfig.class));
}
@ -148,7 +148,7 @@ class PrometheusMetricsExportAutoConfigurationTests {
@Test
void withPushGatewayEnabled(CapturedOutput output) {
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
.withPropertyValues("management.metrics.export.prometheus.pushgateway.enabled=true")
.withPropertyValues("management.prometheus.metrics.export.pushgateway.enabled=true")
.withUserConfiguration(BaseConfiguration.class).run((context) -> {
assertThat(output).doesNotContain("Invalid PushGateway base url");
hasGatewayURL(context, "http://localhost:9091/metrics/");
@ -158,7 +158,7 @@ class PrometheusMetricsExportAutoConfigurationTests {
@Test
void withPushGatewayNoBasicAuth() {
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
.withPropertyValues("management.metrics.export.prometheus.pushgateway.enabled=true")
.withPropertyValues("management.prometheus.metrics.export.pushgateway.enabled=true")
.withUserConfiguration(BaseConfiguration.class)
.run(hasHttpConnectionFactory((httpConnectionFactory) -> assertThat(httpConnectionFactory)
.isInstanceOf(DefaultHttpConnectionFactory.class)));
@ -168,8 +168,8 @@ class PrometheusMetricsExportAutoConfigurationTests {
@Deprecated
void withCustomLegacyPushGatewayURL(CapturedOutput output) {
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
.withPropertyValues("management.metrics.export.prometheus.pushgateway.enabled=true",
"management.metrics.export.prometheus.pushgateway.base-url=localhost:9090")
.withPropertyValues("management.prometheus.metrics.export.pushgateway.enabled=true",
"management.prometheus.metrics.export.pushgateway.base-url=localhost:9090")
.withUserConfiguration(BaseConfiguration.class).run((context) -> {
assertThat(output).contains("Invalid PushGateway base url").contains("localhost:9090");
hasGatewayURL(context, "http://localhost:9090/metrics/");
@ -179,8 +179,8 @@ class PrometheusMetricsExportAutoConfigurationTests {
@Test
void withCustomPushGatewayURL() {
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
.withPropertyValues("management.metrics.export.prometheus.pushgateway.enabled=true",
"management.metrics.export.prometheus.pushgateway.base-url=https://example.com:8080")
.withPropertyValues("management.prometheus.metrics.export.pushgateway.enabled=true",
"management.prometheus.metrics.export.pushgateway.base-url=https://example.com:8080")
.withUserConfiguration(BaseConfiguration.class)
.run((context) -> hasGatewayURL(context, "https://example.com:8080/metrics/"));
}
@ -188,9 +188,9 @@ class PrometheusMetricsExportAutoConfigurationTests {
@Test
void withPushGatewayBasicAuth() {
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
.withPropertyValues("management.metrics.export.prometheus.pushgateway.enabled=true",
"management.metrics.export.prometheus.pushgateway.username=admin",
"management.metrics.export.prometheus.pushgateway.password=secret")
.withPropertyValues("management.prometheus.metrics.export.pushgateway.enabled=true",
"management.prometheus.metrics.export.pushgateway.username=admin",
"management.prometheus.metrics.export.pushgateway.password=secret")
.withUserConfiguration(BaseConfiguration.class)
.run(hasHttpConnectionFactory((httpConnectionFactory) -> assertThat(httpConnectionFactory)
.isInstanceOf(BasicAuthHttpConnectionFactory.class)));

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -53,7 +53,7 @@ class SignalFxMetricsExportAutoConfigurationTests {
@Test
void autoConfiguresWithAnAccessToken() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.signalfx.access-token=abcde")
.withPropertyValues("management.signalfx.metrics.export.access-token=abcde")
.run((context) -> assertThat(context).hasSingleBean(SignalFxMeterRegistry.class)
.hasSingleBean(Clock.class).hasSingleBean(SignalFxConfig.class));
}
@ -61,7 +61,7 @@ class SignalFxMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(SignalFxMeterRegistry.class)
.doesNotHaveBean(SignalFxConfig.class));
}
@ -69,14 +69,14 @@ class SignalFxMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.signalfx.enabled=false")
.withPropertyValues("management.signalfx.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(SignalFxMeterRegistry.class)
.doesNotHaveBean(SignalFxConfig.class));
}
@Test
void allowsConfigToBeCustomized() {
this.contextRunner.withPropertyValues("management.metrics.export.signalfx.access-token=abcde")
this.contextRunner.withPropertyValues("management.signalfx.metrics.export.access-token=abcde")
.withUserConfiguration(CustomConfigConfiguration.class)
.run((context) -> assertThat(context).hasSingleBean(Clock.class)
.hasSingleBean(SignalFxMeterRegistry.class).hasSingleBean(SignalFxConfig.class)
@ -85,7 +85,7 @@ class SignalFxMetricsExportAutoConfigurationTests {
@Test
void allowsRegistryToBeCustomized() {
this.contextRunner.withPropertyValues("management.metrics.export.signalfx.access-token=abcde")
this.contextRunner.withPropertyValues("management.signalfx.metrics.export.access-token=abcde")
.withUserConfiguration(CustomRegistryConfiguration.class)
.run((context) -> assertThat(context).hasSingleBean(Clock.class).hasSingleBean(SignalFxConfig.class)
.hasSingleBean(SignalFxMeterRegistry.class).hasBean("customRegistry"));
@ -93,7 +93,7 @@ class SignalFxMetricsExportAutoConfigurationTests {
@Test
void stopsMeterRegistryWhenContextIsClosed() {
this.contextRunner.withPropertyValues("management.metrics.export.signalfx.access-token=abcde")
this.contextRunner.withPropertyValues("management.signalfx.metrics.export.access-token=abcde")
.withUserConfiguration(BaseConfiguration.class).run((context) -> {
SignalFxMeterRegistry registry = context.getBean(SignalFxMeterRegistry.class);
assertThat(registry.isClosed()).isFalse();

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -51,7 +51,7 @@ class SimpleMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(SimpleMeterRegistry.class)
.doesNotHaveBean(SimpleConfig.class));
}
@ -59,7 +59,7 @@ class SimpleMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.simple.enabled=false")
.withPropertyValues("management.simple.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(SimpleMeterRegistry.class)
.doesNotHaveBean(SimpleConfig.class));
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -53,7 +53,7 @@ class StackdriverMetricsExportAutoConfigurationTests {
@Test
void autoConfiguresConfigAndMeterRegistry() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.stackdriver.project-id=test-project")
.withPropertyValues("management.stackdriver.metrics.export.project-id=test-project")
.run((context) -> assertThat(context).hasSingleBean(StackdriverMeterRegistry.class)
.hasSingleBean(StackdriverConfig.class));
}
@ -61,7 +61,7 @@ class StackdriverMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(StackdriverMeterRegistry.class)
.doesNotHaveBean(StackdriverConfig.class));
}
@ -69,7 +69,7 @@ class StackdriverMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.stackdriver.enabled=false")
.withPropertyValues("management.stackdriver.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(StackdriverMeterRegistry.class)
.doesNotHaveBean(StackdriverConfig.class));
}
@ -84,7 +84,7 @@ class StackdriverMetricsExportAutoConfigurationTests {
@Test
void allowsCustomRegistryToBeUsed() {
this.contextRunner.withUserConfiguration(CustomRegistryConfiguration.class)
.withPropertyValues("management.metrics.export.stackdriver.project-id=test-project")
.withPropertyValues("management.stackdriver.metrics.export.project-id=test-project")
.run((context) -> assertThat(context).hasSingleBean(StackdriverMeterRegistry.class)
.hasBean("customRegistry").hasSingleBean(StackdriverConfig.class));
}
@ -92,7 +92,7 @@ class StackdriverMetricsExportAutoConfigurationTests {
@Test
void stopsMeterRegistryWhenContextIsClosed() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.stackdriver.project-id=test-project").run((context) -> {
.withPropertyValues("management.stackdriver.metrics.export.project-id=test-project").run((context) -> {
StackdriverMeterRegistry registry = context.getBean(StackdriverMeterRegistry.class);
assertThat(registry.isClosed()).isFalse();
context.close();

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -52,14 +52,14 @@ class StatsdMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withPropertyValues("management.metrics.export.defaults.enabled=false")
this.contextRunner.withPropertyValues("management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(StatsdMeterRegistry.class)
.doesNotHaveBean(StatsdConfig.class));
}
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withPropertyValues("management.metrics.export.statsd.enabled=false")
this.contextRunner.withPropertyValues("management.statsd.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(StatsdMeterRegistry.class)
.doesNotHaveBean(StatsdConfig.class));
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@ -60,8 +60,8 @@ class WavefrontMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.wavefront.api-token=abcde",
"management.metrics.export.defaults.enabled=false")
.withPropertyValues("management.wavefront.metrics.export.api-token=abcde",
"management.defaults.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(WavefrontMeterRegistry.class)
.doesNotHaveBean(WavefrontConfig.class).doesNotHaveBean(WavefrontSender.class));
}
@ -69,8 +69,8 @@ class WavefrontMetricsExportAutoConfigurationTests {
@Test
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.wavefront.api-token=abcde",
"management.metrics.export.wavefront.enabled=false")
.withPropertyValues("management.wavefront.metrics.export.api-token=abcde",
"management.wavefront.metrics.export.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(WavefrontMeterRegistry.class)
.doesNotHaveBean(WavefrontConfig.class).doesNotHaveBean(WavefrontSender.class));
}
@ -86,7 +86,7 @@ class WavefrontMetricsExportAutoConfigurationTests {
@Test
void defaultWavefrontSenderSettingsAreConsistent() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.wavefront.api-token=abcde").run((context) -> {
.withPropertyValues("management.wavefront.metrics.export.api-token=abcde").run((context) -> {
WavefrontProperties properties = new WavefrontProperties();
WavefrontSender sender = context.getBean(WavefrontSender.class);
assertThat(sender)
@ -102,10 +102,10 @@ class WavefrontMetricsExportAutoConfigurationTests {
@Test
void configureWavefrontSender() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.wavefront.api-token=abcde",
"management.metrics.export.wavefront.batch-size=50",
"management.metrics.export.wavefront.sender.max-queue-size=100",
"management.metrics.export.wavefront.sender.message-size=1KB")
.withPropertyValues("management.wavefront.metrics.export.api-token=abcde",
"management.wavefront.metrics.export.batch-size=50",
"management.wavefront.metrics.export.sender.max-queue-size=100",
"management.wavefront.metrics.export.sender.message-size=1KB")
.run((context) -> {
WavefrontSender sender = context.getBean(WavefrontSender.class);
assertThat(sender).hasFieldOrPropertyWithValue("batchSize", 50);
@ -127,7 +127,7 @@ class WavefrontMetricsExportAutoConfigurationTests {
@Test
void allowsRegistryToBeCustomized() {
this.contextRunner.withUserConfiguration(CustomRegistryConfiguration.class)
.withPropertyValues("management.metrics.export.wavefront.api-token=abcde")
.withPropertyValues("management.wavefront.metrics.export.api-token=abcde")
.run((context) -> assertThat(context).hasSingleBean(Clock.class).hasSingleBean(WavefrontConfig.class)
.hasSingleBean(WavefrontMeterRegistry.class).hasBean("customRegistry"));
}
@ -135,7 +135,7 @@ class WavefrontMetricsExportAutoConfigurationTests {
@Test
void stopsMeterRegistryWhenContextIsClosed() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("management.metrics.export.wavefront.api-token=abcde").run((context) -> {
.withPropertyValues("management.wavefront.metrics.export.api-token=abcde").run((context) -> {
WavefrontMeterRegistry registry = context.getBean(WavefrontMeterRegistry.class);
assertThat(registry.isClosed()).isFalse();
context.close();

@ -37,9 +37,9 @@ The following example disables Datadog:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
datadog:
metrics:
export:
datadog:
enabled: false
----
@ -48,9 +48,9 @@ You can also disable all registries unless stated otherwise by the registry-spec
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
defaults:
metrics:
export:
defaults:
enabled: false
----
@ -89,9 +89,9 @@ To export metrics to SaaS {micrometer-registry-docs}/appOptics[AppOptics], your
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
appoptics:
metrics:
export:
appoptics:
api-token: "YOUR_TOKEN"
----
@ -105,9 +105,9 @@ You can provide the location of the https://github.com/Netflix/atlas[Atlas serve
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
atlas:
metrics:
export:
atlas:
uri: "https://atlas.example.com:7101/api/v1/publish"
----
@ -121,9 +121,9 @@ To export metrics to {micrometer-registry-docs}/datadog[Datadog], you must provi
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
datadog:
metrics:
export:
datadog:
api-key: "YOUR_KEY"
----
@ -132,9 +132,9 @@ You can also change the interval at which metrics are sent to Datadog:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
datadog:
metrics:
export:
datadog:
step: "30s"
----
@ -174,9 +174,9 @@ The example below configures metrics export using the `example` environment id:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
dynatrace:
metrics:
export:
dynatrace:
uri: "https://example.live.dynatrace.com/api/v2/metrics/ingest"
api-token: "YOUR_TOKEN"
----
@ -194,9 +194,9 @@ In this scenario, the local OneAgent endpoint is used:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
dynatrace:
metrics:
export:
dynatrace:
# Specify uri and api-token here if not using the local OneAgent endpoint.
v2:
metric-key-prefix: "your.key.prefix"
@ -217,9 +217,9 @@ To export metrics to {micrometer-registry-docs}/dynatrace[Dynatrace], your API t
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
dynatrace:
metrics:
export:
dynatrace:
uri: "https://{your-environment-id}.live.dynatrace.com"
api-token: "YOUR_TOKEN"
v1:
@ -239,9 +239,9 @@ The following example sets the export interval to 30 seconds:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
dynatrace:
metrics:
export:
dynatrace:
step: "30s"
----
@ -257,9 +257,9 @@ You can provide the location of the Elastic server to use by using the following
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
elastic:
metrics:
export:
elastic:
host: "https://elastic.example.com:8086"
----
@ -271,9 +271,9 @@ You can provide the http://ganglia.sourceforge.net[Ganglia server] host and port
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
ganglia:
metrics:
export:
ganglia:
host: "ganglia.example.com"
port: 9649
----
@ -288,9 +288,9 @@ You can provide the https://graphiteapp.org[Graphite server] host and port, as t
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
graphite:
metrics:
export:
graphite:
host: "graphite.example.com"
port: 9004
----
@ -315,9 +315,9 @@ To export metrics to SaaS {micrometer-registry-docs}/humio[Humio], you must prov
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
humio:
metrics:
export:
humio:
api-token: "YOUR_TOKEN"
----
@ -326,9 +326,9 @@ You should also configure one or more tags to identify the data source to which
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
humio:
metrics:
export:
humio:
tags:
alpha: "a"
bravo: "b"
@ -345,9 +345,9 @@ You can provide the location of the https://www.influxdata.com[Influx server] to
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
influx:
metrics:
export:
influx:
uri: "https://influx.example.com:8086"
----
@ -362,9 +362,9 @@ You can provide the domain to use by using:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
jmx:
metrics:
export:
jmx:
domain: "com.example.app.metrics"
----
@ -388,9 +388,9 @@ You can provide the location of the https://kairosdb.github.io/[KairosDB server]
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
kairos:
metrics:
export:
kairos:
uri: "https://kairosdb.example.com:8080/api/v1/datapoints"
----
@ -404,9 +404,9 @@ To export metrics to https://newrelic.com[New Relic], you must provide your API
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
newrelic:
metrics:
export:
newrelic:
api-key: "YOUR_KEY"
account-id: "YOUR_ACCOUNT_ID"
----
@ -416,9 +416,9 @@ You can also change the interval at which metrics are sent to New Relic:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
newrelic:
metrics:
export:
newrelic:
step: "30s"
----
@ -427,9 +427,9 @@ By default, metrics are published through REST calls, but you can also use the J
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
newrelic:
metrics:
export:
newrelic:
client-provider-type: "insights-agent"
----
@ -466,10 +466,10 @@ To enable Prometheus Pushgateway support, add the following dependency to your p
</dependency>
----
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.
When the Prometheus Pushgateway dependency is present on the classpath and the configprop:management.prometheus.metrics.export.pushgateway.enabled[] property is set to `true`, a `PrometheusPushGatewayManager` bean is auto-configured.
This manages the pushing of metrics to a Prometheus Pushgateway.
You can tune the `PrometheusPushGatewayManager` by using properties under `management.metrics.export.prometheus.pushgateway`.
You can tune the `PrometheusPushGatewayManager` by using properties under `management.prometheus.metrics.export.pushgateway`.
For advanced configuration, you can also provide your own `PrometheusPushGatewayManager` bean.
@ -482,9 +482,9 @@ To export metrics to https://www.signalfx.com[SignalFx], you must provide your a
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
signalfx:
metrics:
export:
signalfx:
access-token: "YOUR_ACCESS_TOKEN"
----
@ -493,9 +493,9 @@ You can also change the interval at which metrics are sent to SignalFx:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
signalfx:
metrics:
export:
signalfx:
step: "30s"
----
@ -512,9 +512,9 @@ You can also disable it explicitly:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
simple:
metrics:
export:
simple:
enabled: false
----
@ -528,9 +528,9 @@ To export metrics to SaaS {micrometer-registry-docs}/stackdriver[Stackdriver], y
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
stackdriver:
metrics:
export:
stackdriver:
project-id: "my-project"
----
@ -539,9 +539,9 @@ You can also change the interval at which metrics are sent to Stackdriver:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
stackdriver:
metrics:
export:
stackdriver:
step: "30s"
----
@ -556,9 +556,9 @@ You can provide the StatsD agent host, port, and protocol to use by using:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
statsd:
metrics:
export:
statsd:
host: "statsd.example.com"
port: 9125
protocol: "udp"
@ -569,9 +569,9 @@ You can also change the StatsD line protocol to use (it defaults to Datadog):
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
statsd:
metrics:
export:
statsd:
flavor: "etsy"
----
@ -585,9 +585,9 @@ If you are exporting metrics to https://www.wavefront.com/[Wavefront] directly,
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
wavefront:
metrics:
export:
wavefront:
api-token: "YOUR_API_TOKEN"
----
@ -596,9 +596,9 @@ Alternatively, you can use a Wavefront sidecar or an internal proxy in your envi
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
wavefront:
metrics:
export:
wavefront:
uri: "proxy://localhost:2878"
----
@ -609,9 +609,9 @@ You can also change the interval at which metrics are sent to Wavefront:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
management:
wavefront:
metrics:
export:
wavefront:
step: "30s"
----

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -47,8 +47,8 @@ class MetricsExportContextCustomizerFactory implements ContextCustomizerFactory
@Override
public void customizeContext(ConfigurableApplicationContext context,
MergedContextConfiguration mergedContextConfiguration) {
TestPropertyValues.of("management.metrics.export.defaults.enabled=false",
"management.metrics.export.simple.enabled=true").applyTo(context);
TestPropertyValues.of("management.defaults.metrics.export.enabled=false",
"management.simple.metrics.export.enabled=true").applyTo(context);
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -46,8 +46,8 @@ class AutoConfigureMetricsMissingIntegrationTests {
@Test
void customizerRunsAndSetsExclusionPropertiesWhenNoAnnotationPresent(@Autowired Environment environment) {
assertThat(environment.getProperty("management.metrics.export.defaults.enabled")).isEqualTo("false");
assertThat(environment.getProperty("management.metrics.export.simple.enabled")).isEqualTo("true");
assertThat(environment.getProperty("management.defaults.metrics.export.enabled")).isEqualTo("false");
assertThat(environment.getProperty("management.simple.metrics.export.enabled")).isEqualTo("true");
}
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -44,8 +44,8 @@ class AutoConfigureMetricsPresentIntegrationTests {
@Test
void customizerDoesNotSetExclusionPropertiesWhenAnnotationPresent(@Autowired Environment environment) {
assertThat(environment.containsProperty("management.metrics.export.enabled")).isFalse();
assertThat(environment.containsProperty("management.metrics.export.simple.enabled")).isFalse();
assertThat(environment.containsProperty("management.defaults.metrics.export.enabled")).isFalse();
assertThat(environment.containsProperty("management.simple.metrics.export.enabled")).isFalse();
}
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@ -43,9 +43,9 @@ class MetricsExportContextCustomizerFactoryTests {
assertThat(customizer).isNotNull();
ConfigurableApplicationContext context = new GenericApplicationContext();
customizer.customizeContext(context, null);
assertThat(context.getEnvironment().getProperty("management.metrics.export.defaults.enabled"))
assertThat(context.getEnvironment().getProperty("management.defaults.metrics.export.enabled"))
.isEqualTo("false");
assertThat(context.getEnvironment().getProperty("management.metrics.export.simple.enabled")).isEqualTo("true");
assertThat(context.getEnvironment().getProperty("management.simple.metrics.export.enabled")).isEqualTo("true");
}
@Test

Loading…
Cancel
Save