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:
Moritz Halbritter
2022-03-25 16:35:31 +01:00
parent 3af3b26f8e
commit be3523b1cd
64 changed files with 1816 additions and 347 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,8 +47,8 @@ class MetricsExportContextCustomizerFactory implements ContextCustomizerFactory
@Override
public void customizeContext(ConfigurableApplicationContext context,
MergedContextConfiguration mergedContextConfiguration) {
TestPropertyValues.of("management.metrics.export.defaults.enabled=false",
"management.metrics.export.simple.enabled=true").applyTo(context);
TestPropertyValues.of("management.defaults.metrics.export.enabled=false",
"management.simple.metrics.export.enabled=true").applyTo(context);
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,8 +46,8 @@ class AutoConfigureMetricsMissingIntegrationTests {
@Test
void customizerRunsAndSetsExclusionPropertiesWhenNoAnnotationPresent(@Autowired Environment environment) {
assertThat(environment.getProperty("management.metrics.export.defaults.enabled")).isEqualTo("false");
assertThat(environment.getProperty("management.metrics.export.simple.enabled")).isEqualTo("true");
assertThat(environment.getProperty("management.defaults.metrics.export.enabled")).isEqualTo("false");
assertThat(environment.getProperty("management.simple.metrics.export.enabled")).isEqualTo("true");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,8 +44,8 @@ class AutoConfigureMetricsPresentIntegrationTests {
@Test
void customizerDoesNotSetExclusionPropertiesWhenAnnotationPresent(@Autowired Environment environment) {
assertThat(environment.containsProperty("management.metrics.export.enabled")).isFalse();
assertThat(environment.containsProperty("management.metrics.export.simple.enabled")).isFalse();
assertThat(environment.containsProperty("management.defaults.metrics.export.enabled")).isFalse();
assertThat(environment.containsProperty("management.simple.metrics.export.enabled")).isFalse();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,9 +43,9 @@ class MetricsExportContextCustomizerFactoryTests {
assertThat(customizer).isNotNull();
ConfigurableApplicationContext context = new GenericApplicationContext();
customizer.customizeContext(context, null);
assertThat(context.getEnvironment().getProperty("management.metrics.export.defaults.enabled"))
assertThat(context.getEnvironment().getProperty("management.defaults.metrics.export.enabled"))
.isEqualTo("false");
assertThat(context.getEnvironment().getProperty("management.metrics.export.simple.enabled")).isEqualTo("true");
assertThat(context.getEnvironment().getProperty("management.simple.metrics.export.enabled")).isEqualTo("true");
}
@Test