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
This commit is contained in:
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* {@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
|
* 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.
|
* it is not configured.
|
||||||
*
|
*
|
||||||
* @author Chris Bono
|
* @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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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;
|
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.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.
|
* {@link Condition} that checks if a metrics exporter is enabled.
|
||||||
*
|
*
|
||||||
* @author Chris Bono
|
* @author Chris Bono
|
||||||
|
* @author Moritz Halbritter
|
||||||
*/
|
*/
|
||||||
class OnMetricsExportEnabledCondition extends OnEndpointElementCondition {
|
class OnMetricsExportEnabledCondition extends SpringBootCondition {
|
||||||
|
|
||||||
protected OnMetricsExportEnabledCondition() {
|
private static final String PROPERTY_TEMPLATE = "management.%s.metrics.export.enabled";
|
||||||
super("management.metrics.export.", ConditionalOnEnabledMetricsExport.class);
|
|
||||||
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @author Stephane Nicoll
|
||||||
* @since 2.1.0
|
* @since 2.1.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.appoptics")
|
@ConfigurationProperties(prefix = "management.appoptics.metrics.export")
|
||||||
public class AppOpticsProperties extends StepRegistryProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -34,7 +34,7 @@ class AppOpticsPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.appoptics";
|
return "management.appoptics.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @author Stephane Nicoll
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.atlas")
|
@ConfigurationProperties(prefix = "management.atlas.metrics.export")
|
||||||
public class AtlasProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @author Stephane Nicoll
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.datadog")
|
@ConfigurationProperties(prefix = "management.datadog.metrics.export")
|
||||||
public class DatadogProperties extends StepRegistryProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,7 +35,7 @@ class DatadogPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.datadog";
|
return "management.datadog.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @author Georg Pirklbauer
|
||||||
* @since 2.1.0
|
* @since 2.1.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.dynatrace")
|
@ConfigurationProperties(prefix = "management.dynatrace.metrics.export")
|
||||||
public class DynatraceProperties extends StepRegistryProperties {
|
public class DynatraceProperties extends StepRegistryProperties {
|
||||||
|
|
||||||
private final V1 v1 = new V1();
|
private final V1 v1 = new V1();
|
||||||
|
|
@ -57,7 +57,7 @@ public class DynatraceProperties extends StepRegistryProperties {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@DeprecatedConfigurationProperty(replacement = "management.metrics.export.dynatrace.v1.device-id")
|
@DeprecatedConfigurationProperty(replacement = "management.dynatrace.metrics.export.v1.device-id")
|
||||||
public String getDeviceId() {
|
public String getDeviceId() {
|
||||||
return this.v1.getDeviceId();
|
return this.v1.getDeviceId();
|
||||||
}
|
}
|
||||||
|
|
@ -68,7 +68,7 @@ public class DynatraceProperties extends StepRegistryProperties {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@DeprecatedConfigurationProperty(replacement = "management.metrics.export.dynatrace.v1.technology-type")
|
@DeprecatedConfigurationProperty(replacement = "management.dynatrace.metrics.export.v1.technology-type")
|
||||||
public String getTechnologyType() {
|
public String getTechnologyType() {
|
||||||
return this.v1.getTechnologyType();
|
return this.v1.getTechnologyType();
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +87,7 @@ public class DynatraceProperties extends StepRegistryProperties {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@DeprecatedConfigurationProperty(replacement = "management.metrics.export.dynatrace.v1.group")
|
@DeprecatedConfigurationProperty(replacement = "management.dynatrace.metrics.export.v1.group")
|
||||||
public String getGroup() {
|
public String getGroup() {
|
||||||
return this.v1.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -41,7 +41,7 @@ class DynatracePropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.dynatrace";
|
return "management.dynatrace.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @author Andy Wilkinson
|
||||||
* @since 2.1.0
|
* @since 2.1.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.elastic")
|
@ConfigurationProperties(prefix = "management.elastic.metrics.export")
|
||||||
public class ElasticProperties extends StepRegistryProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -34,7 +34,7 @@ class ElasticPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.elastic";
|
return "management.elastic.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.ganglia")
|
@ConfigurationProperties(prefix = "management.ganglia.metrics.export")
|
||||||
public class GangliaProperties {
|
public class GangliaProperties {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class GangliaPropertiesConfigAdapter extends PropertiesConfigAdapter<GangliaProp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.ganglia";
|
return "management.ganglia.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @author Stephane Nicoll
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.graphite")
|
@ConfigurationProperties(prefix = "management.graphite.metrics.export")
|
||||||
public class GraphiteProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -38,7 +38,7 @@ class GraphitePropertiesConfigAdapter extends PropertiesConfigAdapter<GraphitePr
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.graphite";
|
return "management.graphite.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @author Andy Wilkinson
|
||||||
* @since 2.1.0
|
* @since 2.1.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.humio")
|
@ConfigurationProperties(prefix = "management.humio.metrics.export")
|
||||||
public class HumioProperties extends StepRegistryProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,7 +35,7 @@ class HumioPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter<H
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.humio";
|
return "management.humio.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @author Stephane Nicoll
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.influx")
|
@ConfigurationProperties(prefix = "management.influx.metrics.export")
|
||||||
public class InfluxProperties extends StepRegistryProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -37,7 +37,7 @@ class InfluxPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter<
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.influx";
|
return "management.influx.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.jmx")
|
@ConfigurationProperties(prefix = "management.jmx.metrics.export")
|
||||||
public class JmxProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -36,7 +36,7 @@ class JmxPropertiesConfigAdapter extends PropertiesConfigAdapter<JmxProperties>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.jmx";
|
return "management.jmx.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @author Stephane Nicoll
|
||||||
* @since 2.1.0
|
* @since 2.1.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.kairos")
|
@ConfigurationProperties(prefix = "management.kairos.metrics.export")
|
||||||
public class KairosProperties extends StepRegistryProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -34,7 +34,7 @@ class KairosPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter<
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.kairos";
|
return "management.kairos.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @author Neil Powell
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.newrelic")
|
@ConfigurationProperties(prefix = "management.newrelic.metrics.export")
|
||||||
public class NewRelicProperties extends StepRegistryProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -37,7 +37,7 @@ public class NewRelicPropertiesConfigAdapter extends StepRegistryPropertiesConfi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.newrelic";
|
return "management.newrelic.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ public class PrometheusMetricsExportAutoConfiguration {
|
||||||
*/
|
*/
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@ConditionalOnClass(PushGateway.class)
|
@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 {
|
public static class PrometheusPushGatewayConfiguration {
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(PrometheusPushGatewayConfiguration.class);
|
private static final Log logger = LogFactory.getLog(PrometheusPushGatewayConfiguration.class);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.prometheus")
|
@ConfigurationProperties(prefix = "management.prometheus.metrics.export")
|
||||||
public class PrometheusProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -38,7 +38,7 @@ class PrometheusPropertiesConfigAdapter extends PropertiesConfigAdapter<Promethe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.prometheus";
|
return "management.prometheus.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @author Stephane Nicoll
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.signalfx")
|
@ConfigurationProperties(prefix = "management.signalfx.metrics.export")
|
||||||
public class SignalFxProperties extends StepRegistryProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -36,7 +36,7 @@ public class SignalFxPropertiesConfigAdapter extends StepRegistryPropertiesConfi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.signalfx";
|
return "management.signalfx.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.simple")
|
@ConfigurationProperties(prefix = "management.simple.metrics.export")
|
||||||
public class SimpleProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.simple";
|
return "management.simple.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @author Stephane Nicoll
|
||||||
* @since 2.3.0
|
* @since 2.3.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.stackdriver")
|
@ConfigurationProperties(prefix = "management.stackdriver.metrics.export")
|
||||||
public class StackdriverProperties extends StepRegistryProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -37,7 +37,7 @@ public class StackdriverPropertiesConfigAdapter extends StepRegistryPropertiesCo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.stackdriver";
|
return "management.stackdriver.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @author Stephane Nicoll
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "management.metrics.export.statsd")
|
@ConfigurationProperties(prefix = "management.statsd.metrics.export")
|
||||||
public class StatsdProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.statsd";
|
return "management.statsd.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @author Stephane Nicoll
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties("management.metrics.export.wavefront")
|
@ConfigurationProperties("management.wavefront.metrics.export")
|
||||||
public class WavefrontProperties extends PushRegistryProperties {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,7 +35,7 @@ public class WavefrontPropertiesConfigAdapter extends PushRegistryPropertiesConf
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String prefix() {
|
public String prefix() {
|
||||||
return "management.metrics.export.wavefront";
|
return "management.wavefront.metrics.export";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -44,10 +44,10 @@ class ValidationFailureAnalyzerTests {
|
||||||
FailureAnalysis analysis = new ValidationFailureAnalyzer()
|
FailureAnalysis analysis = new ValidationFailureAnalyzer()
|
||||||
.analyze(createFailure(MissingAccountIdAndApiKeyConfiguration.class));
|
.analyze(createFailure(MissingAccountIdAndApiKeyConfiguration.class));
|
||||||
assertThat(analysis).isNotNull();
|
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"
|
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.newrelic.metrics.export.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.accountId was 'null' but it is required when publishing to Insights API"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Exception createFailure(Class<?> configuration) {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -39,21 +39,21 @@ class ConditionalOnEnabledMetricsExportAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void exporterCanBeSpecificallyDisabled() {
|
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"));
|
.run((context) -> assertThat(context).doesNotHaveBean("simpleMeterRegistry"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void exporterCanBeGloballyDisabled() {
|
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"));
|
.run((context) -> assertThat(context).doesNotHaveBean("simpleMeterRegistry"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void exporterCanBeGloballyDisabledWithSpecificOverride() {
|
void exporterCanBeGloballyDisabledWithSpecificOverride() {
|
||||||
this.contextRunner
|
this.contextRunner
|
||||||
.withPropertyValues("management.metrics.export.defaults.enabled=false",
|
.withPropertyValues("management.defaults.metrics.export.enabled=false",
|
||||||
"management.metrics.export.simple.enabled=true")
|
"management.simple.metrics.export.enabled=true")
|
||||||
.run((context) -> assertThat(context).hasBean("simpleMeterRegistry"));
|
.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -46,7 +46,7 @@ class AppOpticsMetricsExportAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void autoConfiguresItsConfigAndMeterRegistry() {
|
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)
|
.withUserConfiguration(BaseConfiguration.class).run((context) -> assertThat(context)
|
||||||
.hasSingleBean(AppOpticsMeterRegistry.class).hasSingleBean(AppOpticsConfig.class));
|
.hasSingleBean(AppOpticsMeterRegistry.class).hasSingleBean(AppOpticsConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +54,7 @@ class AppOpticsMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(AppOpticsMeterRegistry.class)
|
||||||
.doesNotHaveBean(AppOpticsConfig.class));
|
.doesNotHaveBean(AppOpticsConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +62,7 @@ class AppOpticsMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(AppOpticsMeterRegistry.class)
|
||||||
.doesNotHaveBean(AppOpticsConfig.class));
|
.doesNotHaveBean(AppOpticsConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -76,7 +76,7 @@ class AppOpticsMetricsExportAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void allowsCustomRegistryToBeUsed() {
|
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)
|
.withUserConfiguration(CustomRegistryConfiguration.class)
|
||||||
.run((context) -> assertThat(context).hasSingleBean(AppOpticsMeterRegistry.class)
|
.run((context) -> assertThat(context).hasSingleBean(AppOpticsMeterRegistry.class)
|
||||||
.hasBean("customRegistry").hasSingleBean(AppOpticsConfig.class));
|
.hasBean("customRegistry").hasSingleBean(AppOpticsConfig.class));
|
||||||
|
|
@ -84,7 +84,7 @@ class AppOpticsMetricsExportAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void stopsMeterRegistryWhenContextIsClosed() {
|
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) -> {
|
.withUserConfiguration(BaseConfiguration.class).run((context) -> {
|
||||||
AppOpticsMeterRegistry registry = context.getBean(AppOpticsMeterRegistry.class);
|
AppOpticsMeterRegistry registry = context.getBean(AppOpticsMeterRegistry.class);
|
||||||
assertThat(registry.isClosed()).isFalse();
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -53,7 +53,7 @@ class AtlasMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(AtlasMeterRegistry.class)
|
||||||
.doesNotHaveBean(AtlasConfig.class));
|
.doesNotHaveBean(AtlasConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +61,7 @@ class AtlasMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(AtlasMeterRegistry.class)
|
||||||
.doesNotHaveBean(AtlasConfig.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -53,7 +53,7 @@ class DatadogMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfiguresConfigAndMeterRegistry() {
|
void autoConfiguresConfigAndMeterRegistry() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).hasSingleBean(DatadogMeterRegistry.class)
|
||||||
.hasSingleBean(DatadogConfig.class));
|
.hasSingleBean(DatadogConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +61,7 @@ class DatadogMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(DatadogMeterRegistry.class)
|
||||||
.doesNotHaveBean(DatadogConfig.class));
|
.doesNotHaveBean(DatadogConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -69,7 +69,7 @@ class DatadogMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(DatadogMeterRegistry.class)
|
||||||
.doesNotHaveBean(DatadogConfig.class));
|
.doesNotHaveBean(DatadogConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -83,7 +83,7 @@ class DatadogMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void allowsCustomRegistryToBeUsed() {
|
void allowsCustomRegistryToBeUsed() {
|
||||||
this.contextRunner.withUserConfiguration(CustomRegistryConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).hasSingleBean(DatadogMeterRegistry.class)
|
||||||
.hasBean("customRegistry").hasSingleBean(DatadogConfig.class));
|
.hasBean("customRegistry").hasSingleBean(DatadogConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -91,7 +91,7 @@ class DatadogMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void stopsMeterRegistryWhenContextIsClosed() {
|
void stopsMeterRegistryWhenContextIsClosed() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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);
|
DatadogMeterRegistry registry = context.getBean(DatadogMeterRegistry.class);
|
||||||
assertThat(registry.isClosed()).isFalse();
|
assertThat(registry.isClosed()).isFalse();
|
||||||
context.close();
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -50,7 +50,7 @@ class DynatraceMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void failsWithADeviceIdWithoutAUri() {
|
void failsWithADeviceIdWithoutAUri() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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());
|
.run((context) -> assertThat(context).hasFailed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ class DynatraceMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(DynatraceMeterRegistry.class)
|
||||||
.doesNotHaveBean(DynatraceConfig.class));
|
.doesNotHaveBean(DynatraceConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -72,7 +72,7 @@ class DynatraceMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(DynatraceMeterRegistry.class)
|
||||||
.doesNotHaveBean(DynatraceConfig.class));
|
.doesNotHaveBean(DynatraceConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -114,9 +114,9 @@ class DynatraceMetricsExportAutoConfigurationTests {
|
||||||
|
|
||||||
private Function<ApplicationContextRunner, ApplicationContextRunner> v1MandatoryProperties() {
|
private Function<ApplicationContextRunner, ApplicationContextRunner> v1MandatoryProperties() {
|
||||||
return (runner) -> runner.withPropertyValues(
|
return (runner) -> runner.withPropertyValues(
|
||||||
"management.metrics.export.dynatrace.uri=https://dynatrace.example.com",
|
"management.dynatrace.metrics.export.uri=https://dynatrace.example.com",
|
||||||
"management.metrics.export.dynatrace.api-token=abcde",
|
"management.dynatrace.metrics.export.api-token=abcde",
|
||||||
"management.metrics.export.dynatrace.device-id=test");
|
"management.dynatrace.metrics.export.device-id=test");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -54,7 +54,7 @@ class ElasticMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(ElasticMeterRegistry.class)
|
||||||
.doesNotHaveBean(ElasticConfig.class));
|
.doesNotHaveBean(ElasticConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +62,7 @@ class ElasticMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(ElasticMeterRegistry.class)
|
||||||
.doesNotHaveBean(ElasticConfig.class));
|
.doesNotHaveBean(ElasticConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -94,8 +94,8 @@ class ElasticMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void apiKeyCredentialsIsMutuallyExclusiveWithUserName() {
|
void apiKeyCredentialsIsMutuallyExclusiveWithUserName() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||||
.withPropertyValues("management.metrics.export.elastic.api-key-credentials:secret",
|
.withPropertyValues("management.elastic.metrics.export.api-key-credentials:secret",
|
||||||
"management.metrics.export.elastic.user-name:alice")
|
"management.elastic.metrics.export.user-name:alice")
|
||||||
.run((context) -> assertThat(context).hasFailed().getFailure().getRootCause()
|
.run((context) -> assertThat(context).hasFailed().getFailure().getRootCause()
|
||||||
.isInstanceOf(MutuallyExclusiveConfigurationPropertiesException.class));
|
.isInstanceOf(MutuallyExclusiveConfigurationPropertiesException.class));
|
||||||
}
|
}
|
||||||
|
|
@ -103,8 +103,8 @@ class ElasticMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void apiKeyCredentialsIsMutuallyExclusiveWithPassword() {
|
void apiKeyCredentialsIsMutuallyExclusiveWithPassword() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||||
.withPropertyValues("management.metrics.export.elastic.api-key-credentials:secret",
|
.withPropertyValues("management.elastic.metrics.export.api-key-credentials:secret",
|
||||||
"management.metrics.export.elastic.password:secret")
|
"management.elastic.metrics.export.password:secret")
|
||||||
.run((context) -> assertThat(context).hasFailed().getFailure().getRootCause()
|
.run((context) -> assertThat(context).hasFailed().getFailure().getRootCause()
|
||||||
.isInstanceOf(MutuallyExclusiveConfigurationPropertiesException.class));
|
.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -53,7 +53,7 @@ class GangliaMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(GangliaMeterRegistry.class)
|
||||||
.doesNotHaveBean(GangliaConfig.class));
|
.doesNotHaveBean(GangliaConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +61,7 @@ class GangliaMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(GangliaMeterRegistry.class)
|
||||||
.doesNotHaveBean(GangliaConfig.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -49,7 +49,7 @@ class GraphiteMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfiguresUseTagsAsPrefix() {
|
void autoConfiguresUseTagsAsPrefix() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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);
|
assertThat(context).hasSingleBean(GraphiteMeterRegistry.class);
|
||||||
GraphiteMeterRegistry registry = context.getBean(GraphiteMeterRegistry.class);
|
GraphiteMeterRegistry registry = context.getBean(GraphiteMeterRegistry.class);
|
||||||
registry.counter("test.count", Tags.of("app", "myapp"));
|
registry.counter("test.count", Tags.of("app", "myapp"));
|
||||||
|
|
@ -60,8 +60,8 @@ class GraphiteMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfiguresWithTagsAsPrefixCanBeDisabled() {
|
void autoConfiguresWithTagsAsPrefixCanBeDisabled() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||||
.withPropertyValues("management.metrics.export.graphite.tags-as-prefix=app",
|
.withPropertyValues("management.graphite.metrics.export.tags-as-prefix=app",
|
||||||
"management.metrics.export.graphite.graphite-tags-enabled=true")
|
"management.graphite.metrics.export.graphite-tags-enabled=true")
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
assertThat(context).hasSingleBean(GraphiteMeterRegistry.class);
|
assertThat(context).hasSingleBean(GraphiteMeterRegistry.class);
|
||||||
GraphiteMeterRegistry registry = context.getBean(GraphiteMeterRegistry.class);
|
GraphiteMeterRegistry registry = context.getBean(GraphiteMeterRegistry.class);
|
||||||
|
|
@ -79,7 +79,7 @@ class GraphiteMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(GraphiteMeterRegistry.class)
|
||||||
.doesNotHaveBean(GraphiteConfig.class));
|
.doesNotHaveBean(GraphiteConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +87,7 @@ class GraphiteMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(GraphiteMeterRegistry.class)
|
||||||
.doesNotHaveBean(GraphiteConfig.class));
|
.doesNotHaveBean(GraphiteConfig.class));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class HumioMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(HumioMeterRegistry.class)
|
||||||
.doesNotHaveBean(HumioConfig.class));
|
.doesNotHaveBean(HumioConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +62,7 @@ class HumioMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(HumioMeterRegistry.class)
|
||||||
.doesNotHaveBean(HumioConfig.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -53,7 +53,7 @@ class InfluxMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(InfluxMeterRegistry.class)
|
||||||
.doesNotHaveBean(InfluxConfig.class));
|
.doesNotHaveBean(InfluxConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +61,7 @@ class InfluxMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(InfluxMeterRegistry.class)
|
||||||
.doesNotHaveBean(InfluxConfig.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -53,7 +53,7 @@ class JmxMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(JmxMeterRegistry.class)
|
||||||
.doesNotHaveBean(JmxConfig.class));
|
.doesNotHaveBean(JmxConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +61,7 @@ class JmxMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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));
|
.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -53,7 +53,7 @@ class KairosMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(KairosMeterRegistry.class)
|
||||||
.doesNotHaveBean(KairosConfig.class));
|
.doesNotHaveBean(KairosConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +61,7 @@ class KairosMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(KairosMeterRegistry.class)
|
||||||
.doesNotHaveBean(KairosConfig.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -51,32 +51,32 @@ class NewRelicMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void failsWithoutAnApiKey() {
|
void failsWithoutAnApiKey() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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());
|
.run((context) -> assertThat(context).hasFailed());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void failsWithoutAnAccountId() {
|
void failsWithoutAnAccountId() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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());
|
.run((context) -> assertThat(context).hasFailed());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void failsToAutoConfigureWithoutEventType() {
|
void failsToAutoConfigureWithoutEventType() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||||
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
|
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
|
||||||
"management.metrics.export.newrelic.account-id=12345",
|
"management.newrelic.metrics.export.account-id=12345",
|
||||||
"management.metrics.export.newrelic.event-type=")
|
"management.newrelic.metrics.export.event-type=")
|
||||||
.run((context) -> assertThat(context).hasFailed());
|
.run((context) -> assertThat(context).hasFailed());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void autoConfiguresWithEventTypeOverridden() {
|
void autoConfiguresWithEventTypeOverridden() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||||
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
|
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
|
||||||
"management.metrics.export.newrelic.account-id=12345",
|
"management.newrelic.metrics.export.account-id=12345",
|
||||||
"management.metrics.export.newrelic.event-type=wxyz")
|
"management.newrelic.metrics.export.event-type=wxyz")
|
||||||
.run((context) -> assertThat(context).hasSingleBean(NewRelicMeterRegistry.class)
|
.run((context) -> assertThat(context).hasSingleBean(NewRelicMeterRegistry.class)
|
||||||
.hasSingleBean(Clock.class).hasSingleBean(NewRelicConfig.class));
|
.hasSingleBean(Clock.class).hasSingleBean(NewRelicConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -84,10 +84,10 @@ class NewRelicMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfiguresWithMeterNameEventTypeEnabledAndWithoutEventType() {
|
void autoConfiguresWithMeterNameEventTypeEnabledAndWithoutEventType() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||||
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
|
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
|
||||||
"management.metrics.export.newrelic.account-id=12345",
|
"management.newrelic.metrics.export.account-id=12345",
|
||||||
"management.metrics.export.newrelic.event-type=",
|
"management.newrelic.metrics.export.event-type=",
|
||||||
"management.metrics.export.newrelic.meter-name-event-type-enabled=true")
|
"management.newrelic.metrics.export.meter-name-event-type-enabled=true")
|
||||||
.run((context) -> assertThat(context).hasSingleBean(NewRelicMeterRegistry.class)
|
.run((context) -> assertThat(context).hasSingleBean(NewRelicMeterRegistry.class)
|
||||||
.hasSingleBean(Clock.class).hasSingleBean(NewRelicConfig.class));
|
.hasSingleBean(Clock.class).hasSingleBean(NewRelicConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -95,8 +95,8 @@ class NewRelicMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfiguresWithAccountIdAndApiKey() {
|
void autoConfiguresWithAccountIdAndApiKey() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||||
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
|
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
|
||||||
"management.metrics.export.newrelic.account-id=12345")
|
"management.newrelic.metrics.export.account-id=12345")
|
||||||
.run((context) -> assertThat(context).hasSingleBean(NewRelicMeterRegistry.class)
|
.run((context) -> assertThat(context).hasSingleBean(NewRelicMeterRegistry.class)
|
||||||
.hasSingleBean(Clock.class).hasSingleBean(NewRelicConfig.class));
|
.hasSingleBean(Clock.class).hasSingleBean(NewRelicConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +104,7 @@ class NewRelicMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(NewRelicMeterRegistry.class)
|
||||||
.doesNotHaveBean(NewRelicConfig.class));
|
.doesNotHaveBean(NewRelicConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -112,7 +112,7 @@ class NewRelicMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(NewRelicMeterRegistry.class)
|
||||||
.doesNotHaveBean(NewRelicConfig.class));
|
.doesNotHaveBean(NewRelicConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -120,16 +120,16 @@ class NewRelicMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void allowsConfigToBeCustomized() {
|
void allowsConfigToBeCustomized() {
|
||||||
this.contextRunner.withUserConfiguration(CustomConfigConfiguration.class)
|
this.contextRunner.withUserConfiguration(CustomConfigConfiguration.class)
|
||||||
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
|
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
|
||||||
"management.metrics.export.newrelic.account-id=12345")
|
"management.newrelic.metrics.export.account-id=12345")
|
||||||
.run((context) -> assertThat(context).hasSingleBean(NewRelicConfig.class).hasBean("customConfig"));
|
.run((context) -> assertThat(context).hasSingleBean(NewRelicConfig.class).hasBean("customConfig"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void allowsRegistryToBeCustomized() {
|
void allowsRegistryToBeCustomized() {
|
||||||
this.contextRunner.withUserConfiguration(CustomRegistryConfiguration.class)
|
this.contextRunner.withUserConfiguration(CustomRegistryConfiguration.class)
|
||||||
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
|
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
|
||||||
"management.metrics.export.newrelic.account-id=12345")
|
"management.newrelic.metrics.export.account-id=12345")
|
||||||
.run((context) -> assertThat(context).hasSingleBean(NewRelicMeterRegistry.class)
|
.run((context) -> assertThat(context).hasSingleBean(NewRelicMeterRegistry.class)
|
||||||
.hasBean("customRegistry"));
|
.hasBean("customRegistry"));
|
||||||
}
|
}
|
||||||
|
|
@ -137,8 +137,8 @@ class NewRelicMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void allowsClientProviderToBeCustomized() {
|
void allowsClientProviderToBeCustomized() {
|
||||||
this.contextRunner.withUserConfiguration(CustomClientProviderConfiguration.class)
|
this.contextRunner.withUserConfiguration(CustomClientProviderConfiguration.class)
|
||||||
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
|
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
|
||||||
"management.metrics.export.newrelic.account-id=12345")
|
"management.newrelic.metrics.export.account-id=12345")
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
assertThat(context).hasSingleBean(NewRelicMeterRegistry.class);
|
assertThat(context).hasSingleBean(NewRelicMeterRegistry.class);
|
||||||
assertThat(context.getBean(NewRelicMeterRegistry.class))
|
assertThat(context.getBean(NewRelicMeterRegistry.class))
|
||||||
|
|
@ -149,8 +149,8 @@ class NewRelicMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void stopsMeterRegistryWhenContextIsClosed() {
|
void stopsMeterRegistryWhenContextIsClosed() {
|
||||||
this.contextRunner
|
this.contextRunner
|
||||||
.withPropertyValues("management.metrics.export.newrelic.api-key=abcde",
|
.withPropertyValues("management.newrelic.metrics.export.api-key=abcde",
|
||||||
"management.metrics.export.newrelic.account-id=abcde")
|
"management.newrelic.metrics.export.account-id=abcde")
|
||||||
.withUserConfiguration(BaseConfiguration.class).run((context) -> {
|
.withUserConfiguration(BaseConfiguration.class).run((context) -> {
|
||||||
NewRelicMeterRegistry registry = context.getBean(NewRelicMeterRegistry.class);
|
NewRelicMeterRegistry registry = context.getBean(NewRelicMeterRegistry.class);
|
||||||
assertThat(registry.isClosed()).isFalse();
|
assertThat(registry.isClosed()).isFalse();
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ class PrometheusMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(PrometheusMeterRegistry.class)
|
||||||
.doesNotHaveBean(CollectorRegistry.class).doesNotHaveBean(PrometheusConfig.class));
|
.doesNotHaveBean(CollectorRegistry.class).doesNotHaveBean(PrometheusConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +79,7 @@ class PrometheusMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(PrometheusMeterRegistry.class)
|
||||||
.doesNotHaveBean(CollectorRegistry.class).doesNotHaveBean(PrometheusConfig.class));
|
.doesNotHaveBean(CollectorRegistry.class).doesNotHaveBean(PrometheusConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -148,7 +148,7 @@ class PrometheusMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void withPushGatewayEnabled(CapturedOutput output) {
|
void withPushGatewayEnabled(CapturedOutput output) {
|
||||||
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
|
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) -> {
|
.withUserConfiguration(BaseConfiguration.class).run((context) -> {
|
||||||
assertThat(output).doesNotContain("Invalid PushGateway base url");
|
assertThat(output).doesNotContain("Invalid PushGateway base url");
|
||||||
hasGatewayURL(context, "http://localhost:9091/metrics/");
|
hasGatewayURL(context, "http://localhost:9091/metrics/");
|
||||||
|
|
@ -158,7 +158,7 @@ class PrometheusMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void withPushGatewayNoBasicAuth() {
|
void withPushGatewayNoBasicAuth() {
|
||||||
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
|
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)
|
.withUserConfiguration(BaseConfiguration.class)
|
||||||
.run(hasHttpConnectionFactory((httpConnectionFactory) -> assertThat(httpConnectionFactory)
|
.run(hasHttpConnectionFactory((httpConnectionFactory) -> assertThat(httpConnectionFactory)
|
||||||
.isInstanceOf(DefaultHttpConnectionFactory.class)));
|
.isInstanceOf(DefaultHttpConnectionFactory.class)));
|
||||||
|
|
@ -168,8 +168,8 @@ class PrometheusMetricsExportAutoConfigurationTests {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void withCustomLegacyPushGatewayURL(CapturedOutput output) {
|
void withCustomLegacyPushGatewayURL(CapturedOutput output) {
|
||||||
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
|
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
|
||||||
.withPropertyValues("management.metrics.export.prometheus.pushgateway.enabled=true",
|
.withPropertyValues("management.prometheus.metrics.export.pushgateway.enabled=true",
|
||||||
"management.metrics.export.prometheus.pushgateway.base-url=localhost:9090")
|
"management.prometheus.metrics.export.pushgateway.base-url=localhost:9090")
|
||||||
.withUserConfiguration(BaseConfiguration.class).run((context) -> {
|
.withUserConfiguration(BaseConfiguration.class).run((context) -> {
|
||||||
assertThat(output).contains("Invalid PushGateway base url").contains("localhost:9090");
|
assertThat(output).contains("Invalid PushGateway base url").contains("localhost:9090");
|
||||||
hasGatewayURL(context, "http://localhost:9090/metrics/");
|
hasGatewayURL(context, "http://localhost:9090/metrics/");
|
||||||
|
|
@ -179,8 +179,8 @@ class PrometheusMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void withCustomPushGatewayURL() {
|
void withCustomPushGatewayURL() {
|
||||||
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
|
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
|
||||||
.withPropertyValues("management.metrics.export.prometheus.pushgateway.enabled=true",
|
.withPropertyValues("management.prometheus.metrics.export.pushgateway.enabled=true",
|
||||||
"management.metrics.export.prometheus.pushgateway.base-url=https://example.com:8080")
|
"management.prometheus.metrics.export.pushgateway.base-url=https://example.com:8080")
|
||||||
.withUserConfiguration(BaseConfiguration.class)
|
.withUserConfiguration(BaseConfiguration.class)
|
||||||
.run((context) -> hasGatewayURL(context, "https://example.com:8080/metrics/"));
|
.run((context) -> hasGatewayURL(context, "https://example.com:8080/metrics/"));
|
||||||
}
|
}
|
||||||
|
|
@ -188,9 +188,9 @@ class PrometheusMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void withPushGatewayBasicAuth() {
|
void withPushGatewayBasicAuth() {
|
||||||
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
|
this.contextRunner.withConfiguration(AutoConfigurations.of(ManagementContextAutoConfiguration.class))
|
||||||
.withPropertyValues("management.metrics.export.prometheus.pushgateway.enabled=true",
|
.withPropertyValues("management.prometheus.metrics.export.pushgateway.enabled=true",
|
||||||
"management.metrics.export.prometheus.pushgateway.username=admin",
|
"management.prometheus.metrics.export.pushgateway.username=admin",
|
||||||
"management.metrics.export.prometheus.pushgateway.password=secret")
|
"management.prometheus.metrics.export.pushgateway.password=secret")
|
||||||
.withUserConfiguration(BaseConfiguration.class)
|
.withUserConfiguration(BaseConfiguration.class)
|
||||||
.run(hasHttpConnectionFactory((httpConnectionFactory) -> assertThat(httpConnectionFactory)
|
.run(hasHttpConnectionFactory((httpConnectionFactory) -> assertThat(httpConnectionFactory)
|
||||||
.isInstanceOf(BasicAuthHttpConnectionFactory.class)));
|
.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -53,7 +53,7 @@ class SignalFxMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfiguresWithAnAccessToken() {
|
void autoConfiguresWithAnAccessToken() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).hasSingleBean(SignalFxMeterRegistry.class)
|
||||||
.hasSingleBean(Clock.class).hasSingleBean(SignalFxConfig.class));
|
.hasSingleBean(Clock.class).hasSingleBean(SignalFxConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +61,7 @@ class SignalFxMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(SignalFxMeterRegistry.class)
|
||||||
.doesNotHaveBean(SignalFxConfig.class));
|
.doesNotHaveBean(SignalFxConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -69,14 +69,14 @@ class SignalFxMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(SignalFxMeterRegistry.class)
|
||||||
.doesNotHaveBean(SignalFxConfig.class));
|
.doesNotHaveBean(SignalFxConfig.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void allowsConfigToBeCustomized() {
|
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)
|
.withUserConfiguration(CustomConfigConfiguration.class)
|
||||||
.run((context) -> assertThat(context).hasSingleBean(Clock.class)
|
.run((context) -> assertThat(context).hasSingleBean(Clock.class)
|
||||||
.hasSingleBean(SignalFxMeterRegistry.class).hasSingleBean(SignalFxConfig.class)
|
.hasSingleBean(SignalFxMeterRegistry.class).hasSingleBean(SignalFxConfig.class)
|
||||||
|
|
@ -85,7 +85,7 @@ class SignalFxMetricsExportAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void allowsRegistryToBeCustomized() {
|
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)
|
.withUserConfiguration(CustomRegistryConfiguration.class)
|
||||||
.run((context) -> assertThat(context).hasSingleBean(Clock.class).hasSingleBean(SignalFxConfig.class)
|
.run((context) -> assertThat(context).hasSingleBean(Clock.class).hasSingleBean(SignalFxConfig.class)
|
||||||
.hasSingleBean(SignalFxMeterRegistry.class).hasBean("customRegistry"));
|
.hasSingleBean(SignalFxMeterRegistry.class).hasBean("customRegistry"));
|
||||||
|
|
@ -93,7 +93,7 @@ class SignalFxMetricsExportAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void stopsMeterRegistryWhenContextIsClosed() {
|
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) -> {
|
.withUserConfiguration(BaseConfiguration.class).run((context) -> {
|
||||||
SignalFxMeterRegistry registry = context.getBean(SignalFxMeterRegistry.class);
|
SignalFxMeterRegistry registry = context.getBean(SignalFxMeterRegistry.class);
|
||||||
assertThat(registry.isClosed()).isFalse();
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -51,7 +51,7 @@ class SimpleMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(SimpleMeterRegistry.class)
|
||||||
.doesNotHaveBean(SimpleConfig.class));
|
.doesNotHaveBean(SimpleConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +59,7 @@ class SimpleMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(SimpleMeterRegistry.class)
|
||||||
.doesNotHaveBean(SimpleConfig.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -53,7 +53,7 @@ class StackdriverMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfiguresConfigAndMeterRegistry() {
|
void autoConfiguresConfigAndMeterRegistry() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).hasSingleBean(StackdriverMeterRegistry.class)
|
||||||
.hasSingleBean(StackdriverConfig.class));
|
.hasSingleBean(StackdriverConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +61,7 @@ class StackdriverMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(StackdriverMeterRegistry.class)
|
||||||
.doesNotHaveBean(StackdriverConfig.class));
|
.doesNotHaveBean(StackdriverConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -69,7 +69,7 @@ class StackdriverMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(StackdriverMeterRegistry.class)
|
||||||
.doesNotHaveBean(StackdriverConfig.class));
|
.doesNotHaveBean(StackdriverConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -84,7 +84,7 @@ class StackdriverMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void allowsCustomRegistryToBeUsed() {
|
void allowsCustomRegistryToBeUsed() {
|
||||||
this.contextRunner.withUserConfiguration(CustomRegistryConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).hasSingleBean(StackdriverMeterRegistry.class)
|
||||||
.hasBean("customRegistry").hasSingleBean(StackdriverConfig.class));
|
.hasBean("customRegistry").hasSingleBean(StackdriverConfig.class));
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +92,7 @@ class StackdriverMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void stopsMeterRegistryWhenContextIsClosed() {
|
void stopsMeterRegistryWhenContextIsClosed() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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);
|
StackdriverMeterRegistry registry = context.getBean(StackdriverMeterRegistry.class);
|
||||||
assertThat(registry.isClosed()).isFalse();
|
assertThat(registry.isClosed()).isFalse();
|
||||||
context.close();
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -52,14 +52,14 @@ class StatsdMetricsExportAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(StatsdMeterRegistry.class)
|
||||||
.doesNotHaveBean(StatsdConfig.class));
|
.doesNotHaveBean(StatsdConfig.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
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)
|
.run((context) -> assertThat(context).doesNotHaveBean(StatsdMeterRegistry.class)
|
||||||
.doesNotHaveBean(StatsdConfig.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -60,8 +60,8 @@ class WavefrontMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithDefaultsEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||||
.withPropertyValues("management.metrics.export.wavefront.api-token=abcde",
|
.withPropertyValues("management.wavefront.metrics.export.api-token=abcde",
|
||||||
"management.metrics.export.defaults.enabled=false")
|
"management.defaults.metrics.export.enabled=false")
|
||||||
.run((context) -> assertThat(context).doesNotHaveBean(WavefrontMeterRegistry.class)
|
.run((context) -> assertThat(context).doesNotHaveBean(WavefrontMeterRegistry.class)
|
||||||
.doesNotHaveBean(WavefrontConfig.class).doesNotHaveBean(WavefrontSender.class));
|
.doesNotHaveBean(WavefrontConfig.class).doesNotHaveBean(WavefrontSender.class));
|
||||||
}
|
}
|
||||||
|
|
@ -69,8 +69,8 @@ class WavefrontMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
void autoConfigurationCanBeDisabledWithSpecificEnabledProperty() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||||
.withPropertyValues("management.metrics.export.wavefront.api-token=abcde",
|
.withPropertyValues("management.wavefront.metrics.export.api-token=abcde",
|
||||||
"management.metrics.export.wavefront.enabled=false")
|
"management.wavefront.metrics.export.enabled=false")
|
||||||
.run((context) -> assertThat(context).doesNotHaveBean(WavefrontMeterRegistry.class)
|
.run((context) -> assertThat(context).doesNotHaveBean(WavefrontMeterRegistry.class)
|
||||||
.doesNotHaveBean(WavefrontConfig.class).doesNotHaveBean(WavefrontSender.class));
|
.doesNotHaveBean(WavefrontConfig.class).doesNotHaveBean(WavefrontSender.class));
|
||||||
}
|
}
|
||||||
|
|
@ -86,7 +86,7 @@ class WavefrontMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void defaultWavefrontSenderSettingsAreConsistent() {
|
void defaultWavefrontSenderSettingsAreConsistent() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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();
|
WavefrontProperties properties = new WavefrontProperties();
|
||||||
WavefrontSender sender = context.getBean(WavefrontSender.class);
|
WavefrontSender sender = context.getBean(WavefrontSender.class);
|
||||||
assertThat(sender)
|
assertThat(sender)
|
||||||
|
|
@ -102,10 +102,10 @@ class WavefrontMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void configureWavefrontSender() {
|
void configureWavefrontSender() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||||
.withPropertyValues("management.metrics.export.wavefront.api-token=abcde",
|
.withPropertyValues("management.wavefront.metrics.export.api-token=abcde",
|
||||||
"management.metrics.export.wavefront.batch-size=50",
|
"management.wavefront.metrics.export.batch-size=50",
|
||||||
"management.metrics.export.wavefront.sender.max-queue-size=100",
|
"management.wavefront.metrics.export.sender.max-queue-size=100",
|
||||||
"management.metrics.export.wavefront.sender.message-size=1KB")
|
"management.wavefront.metrics.export.sender.message-size=1KB")
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
WavefrontSender sender = context.getBean(WavefrontSender.class);
|
WavefrontSender sender = context.getBean(WavefrontSender.class);
|
||||||
assertThat(sender).hasFieldOrPropertyWithValue("batchSize", 50);
|
assertThat(sender).hasFieldOrPropertyWithValue("batchSize", 50);
|
||||||
|
|
@ -127,7 +127,7 @@ class WavefrontMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void allowsRegistryToBeCustomized() {
|
void allowsRegistryToBeCustomized() {
|
||||||
this.contextRunner.withUserConfiguration(CustomRegistryConfiguration.class)
|
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)
|
.run((context) -> assertThat(context).hasSingleBean(Clock.class).hasSingleBean(WavefrontConfig.class)
|
||||||
.hasSingleBean(WavefrontMeterRegistry.class).hasBean("customRegistry"));
|
.hasSingleBean(WavefrontMeterRegistry.class).hasBean("customRegistry"));
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +135,7 @@ class WavefrontMetricsExportAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void stopsMeterRegistryWhenContextIsClosed() {
|
void stopsMeterRegistryWhenContextIsClosed() {
|
||||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
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);
|
WavefrontMeterRegistry registry = context.getBean(WavefrontMeterRegistry.class);
|
||||||
assertThat(registry.isClosed()).isFalse();
|
assertThat(registry.isClosed()).isFalse();
|
||||||
context.close();
|
context.close();
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,9 @@ The following example disables Datadog:
|
||||||
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
datadog:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
datadog:
|
|
||||||
enabled: false
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
defaults:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
defaults:
|
|
||||||
enabled: false
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
appoptics:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
appoptics:
|
|
||||||
api-token: "YOUR_TOKEN"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
atlas:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
atlas:
|
|
||||||
uri: "https://atlas.example.com:7101/api/v1/publish"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
datadog:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
datadog:
|
|
||||||
api-key: "YOUR_KEY"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
datadog:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
datadog:
|
|
||||||
step: "30s"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
dynatrace:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
dynatrace:
|
|
||||||
uri: "https://example.live.dynatrace.com/api/v2/metrics/ingest"
|
uri: "https://example.live.dynatrace.com/api/v2/metrics/ingest"
|
||||||
api-token: "YOUR_TOKEN"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
dynatrace:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
dynatrace:
|
|
||||||
# Specify uri and api-token here if not using the local OneAgent endpoint.
|
# Specify uri and api-token here if not using the local OneAgent endpoint.
|
||||||
v2:
|
v2:
|
||||||
metric-key-prefix: "your.key.prefix"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
dynatrace:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
dynatrace:
|
|
||||||
uri: "https://{your-environment-id}.live.dynatrace.com"
|
uri: "https://{your-environment-id}.live.dynatrace.com"
|
||||||
api-token: "YOUR_TOKEN"
|
api-token: "YOUR_TOKEN"
|
||||||
v1:
|
v1:
|
||||||
|
|
@ -239,9 +239,9 @@ The following example sets the export interval to 30 seconds:
|
||||||
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
dynatrace:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
dynatrace:
|
|
||||||
step: "30s"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
elastic:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
elastic:
|
|
||||||
host: "https://elastic.example.com:8086"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
ganglia:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
ganglia:
|
|
||||||
host: "ganglia.example.com"
|
host: "ganglia.example.com"
|
||||||
port: 9649
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
graphite:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
graphite:
|
|
||||||
host: "graphite.example.com"
|
host: "graphite.example.com"
|
||||||
port: 9004
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
humio:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
humio:
|
|
||||||
api-token: "YOUR_TOKEN"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
humio:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
humio:
|
|
||||||
tags:
|
tags:
|
||||||
alpha: "a"
|
alpha: "a"
|
||||||
bravo: "b"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
influx:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
influx:
|
|
||||||
uri: "https://influx.example.com:8086"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
jmx:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
jmx:
|
|
||||||
domain: "com.example.app.metrics"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
kairos:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
kairos:
|
|
||||||
uri: "https://kairosdb.example.com:8080/api/v1/datapoints"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
newrelic:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
newrelic:
|
|
||||||
api-key: "YOUR_KEY"
|
api-key: "YOUR_KEY"
|
||||||
account-id: "YOUR_ACCOUNT_ID"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
newrelic:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
newrelic:
|
|
||||||
step: "30s"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
newrelic:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
newrelic:
|
|
||||||
client-provider-type: "insights-agent"
|
client-provider-type: "insights-agent"
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
@ -466,10 +466,10 @@ To enable Prometheus Pushgateway support, add the following dependency to your p
|
||||||
</dependency>
|
</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.
|
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.
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
signalfx:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
signalfx:
|
|
||||||
access-token: "YOUR_ACCESS_TOKEN"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
signalfx:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
signalfx:
|
|
||||||
step: "30s"
|
step: "30s"
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
@ -512,9 +512,9 @@ You can also disable it explicitly:
|
||||||
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
simple:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
simple:
|
|
||||||
enabled: false
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
stackdriver:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
stackdriver:
|
|
||||||
project-id: "my-project"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
stackdriver:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
stackdriver:
|
|
||||||
step: "30s"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
statsd:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
statsd:
|
|
||||||
host: "statsd.example.com"
|
host: "statsd.example.com"
|
||||||
port: 9125
|
port: 9125
|
||||||
protocol: "udp"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
statsd:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
statsd:
|
|
||||||
flavor: "etsy"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
wavefront:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
wavefront:
|
|
||||||
api-token: "YOUR_API_TOKEN"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
wavefront:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
wavefront:
|
|
||||||
uri: "proxy://localhost:2878"
|
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]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
----
|
----
|
||||||
management:
|
management:
|
||||||
|
wavefront:
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
wavefront:
|
|
||||||
step: "30s"
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -47,8 +47,8 @@ class MetricsExportContextCustomizerFactory implements ContextCustomizerFactory
|
||||||
@Override
|
@Override
|
||||||
public void customizeContext(ConfigurableApplicationContext context,
|
public void customizeContext(ConfigurableApplicationContext context,
|
||||||
MergedContextConfiguration mergedContextConfiguration) {
|
MergedContextConfiguration mergedContextConfiguration) {
|
||||||
TestPropertyValues.of("management.metrics.export.defaults.enabled=false",
|
TestPropertyValues.of("management.defaults.metrics.export.enabled=false",
|
||||||
"management.metrics.export.simple.enabled=true").applyTo(context);
|
"management.simple.metrics.export.enabled=true").applyTo(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -46,8 +46,8 @@ class AutoConfigureMetricsMissingIntegrationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void customizerRunsAndSetsExclusionPropertiesWhenNoAnnotationPresent(@Autowired Environment environment) {
|
void customizerRunsAndSetsExclusionPropertiesWhenNoAnnotationPresent(@Autowired Environment environment) {
|
||||||
assertThat(environment.getProperty("management.metrics.export.defaults.enabled")).isEqualTo("false");
|
assertThat(environment.getProperty("management.defaults.metrics.export.enabled")).isEqualTo("false");
|
||||||
assertThat(environment.getProperty("management.metrics.export.simple.enabled")).isEqualTo("true");
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -44,8 +44,8 @@ class AutoConfigureMetricsPresentIntegrationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void customizerDoesNotSetExclusionPropertiesWhenAnnotationPresent(@Autowired Environment environment) {
|
void customizerDoesNotSetExclusionPropertiesWhenAnnotationPresent(@Autowired Environment environment) {
|
||||||
assertThat(environment.containsProperty("management.metrics.export.enabled")).isFalse();
|
assertThat(environment.containsProperty("management.defaults.metrics.export.enabled")).isFalse();
|
||||||
assertThat(environment.containsProperty("management.metrics.export.simple.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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -43,9 +43,9 @@ class MetricsExportContextCustomizerFactoryTests {
|
||||||
assertThat(customizer).isNotNull();
|
assertThat(customizer).isNotNull();
|
||||||
ConfigurableApplicationContext context = new GenericApplicationContext();
|
ConfigurableApplicationContext context = new GenericApplicationContext();
|
||||||
customizer.customizeContext(context, null);
|
customizer.customizeContext(context, null);
|
||||||
assertThat(context.getEnvironment().getProperty("management.metrics.export.defaults.enabled"))
|
assertThat(context.getEnvironment().getProperty("management.defaults.metrics.export.enabled"))
|
||||||
.isEqualTo("false");
|
.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
|
@Test
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue