Auto-configure Micrometer's HumioMeterRegistry
Closes gh-14804
This commit is contained in:
@@ -127,6 +127,11 @@
|
||||
<artifactId>micrometer-registry-graphite</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-humio</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-influx</artifactId>
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2012-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics.export.humio;
|
||||
|
||||
import io.micrometer.core.instrument.Clock;
|
||||
import io.micrometer.humio.HumioConfig;
|
||||
import io.micrometer.humio.HumioMeterRegistry;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for exporting metrics to Humio.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 2.1.0
|
||||
*/
|
||||
@Configuration
|
||||
@AutoConfigureBefore({ CompositeMeterRegistryAutoConfiguration.class,
|
||||
SimpleMetricsExportAutoConfiguration.class })
|
||||
@AutoConfigureAfter(MetricsAutoConfiguration.class)
|
||||
@ConditionalOnBean(Clock.class)
|
||||
@ConditionalOnClass(HumioMeterRegistry.class)
|
||||
@ConditionalOnProperty(prefix = "management.metrics.export.humio", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
@EnableConfigurationProperties(HumioProperties.class)
|
||||
public class HumioMetricsExportAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public HumioConfig humioConfig(HumioProperties humioProperties) {
|
||||
return new HumioPropertiesConfigAdapter(humioProperties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public HumioMeterRegistry humioMeterRegistry(HumioConfig humioConfig, Clock clock) {
|
||||
return new HumioMeterRegistry(humioConfig, clock);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright 2012-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics.export.humio;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.StepRegistryProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* {@link ConfigurationProperties} for configuring Humio metrics export.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 2.1.0
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "management.metrics.export.humio")
|
||||
public class HumioProperties extends StepRegistryProperties {
|
||||
|
||||
/**
|
||||
* Humio API token.
|
||||
*/
|
||||
private String apiToken;
|
||||
|
||||
/**
|
||||
* Connection timeout for requests to Humio.
|
||||
*/
|
||||
private Duration connectTimeout = Duration.ofSeconds(5);
|
||||
|
||||
/**
|
||||
* Name of the repository to publish metrics to.
|
||||
*/
|
||||
private String repository = "sandbox";
|
||||
|
||||
/**
|
||||
* Humio tags describing the data source in which metrics will be stored. Humio tags
|
||||
* are a distinct concept from Micrometer's tags. Micrometer's tags are used to divide
|
||||
* metrics along dimensional boundaries.
|
||||
*/
|
||||
private Map<String, String> tags = new HashMap<>();
|
||||
|
||||
/**
|
||||
* URI to ship metrics to. If you need to publish metrics to an internal proxy
|
||||
* en-route to Humio, you can define the location of the proxy with this.
|
||||
*/
|
||||
private String uri = "https://cloud.humio.com";
|
||||
|
||||
public String getApiToken() {
|
||||
return this.apiToken;
|
||||
}
|
||||
|
||||
public void setApiToken(String apiToken) {
|
||||
this.apiToken = apiToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration getConnectTimeout() {
|
||||
return this.connectTimeout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConnectTimeout(Duration connectTimeout) {
|
||||
this.connectTimeout = connectTimeout;
|
||||
}
|
||||
|
||||
public String getRepository() {
|
||||
return this.repository;
|
||||
}
|
||||
|
||||
public void setRepository(String repository) {
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
public Map<String, String> getTags() {
|
||||
return this.tags;
|
||||
}
|
||||
|
||||
public void setTags(Map<String, String> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return this.uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2012-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics.export.humio;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.micrometer.humio.HumioConfig;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.StepRegistryPropertiesConfigAdapter;
|
||||
|
||||
/**
|
||||
* Adapter to convert {@link HumioProperties} to a {@link HumioConfig}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
class HumioPropertiesConfigAdapter extends
|
||||
StepRegistryPropertiesConfigAdapter<HumioProperties> implements HumioConfig {
|
||||
|
||||
HumioPropertiesConfigAdapter(HumioProperties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(String k) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uri() {
|
||||
return get(HumioProperties::getUri, HumioConfig.super::uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String repository() {
|
||||
return get(HumioProperties::getRepository, HumioConfig.super::repository);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> tags() {
|
||||
return get(HumioProperties::getTags, HumioConfig.super::tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiToken() {
|
||||
return get(HumioProperties::getApiToken, HumioConfig.super::apiToken);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2012-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Support for exporting actuator metrics to Humio.
|
||||
*/
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics.export.humio;
|
||||
@@ -52,6 +52,7 @@ org.springframework.boot.actuate.autoconfigure.metrics.export.dynatrace.Dynatrac
|
||||
org.springframework.boot.actuate.autoconfigure.metrics.export.elastic.ElasticMetricsExportAutoConfiguration,\
|
||||
org.springframework.boot.actuate.autoconfigure.metrics.export.ganglia.GangliaMetricsExportAutoConfiguration,\
|
||||
org.springframework.boot.actuate.autoconfigure.metrics.export.graphite.GraphiteMetricsExportAutoConfiguration,\
|
||||
org.springframework.boot.actuate.autoconfigure.metrics.export.humio.HumioMetricsExportAutoConfiguration,\
|
||||
org.springframework.boot.actuate.autoconfigure.metrics.export.influx.InfluxMetricsExportAutoConfiguration,\
|
||||
org.springframework.boot.actuate.autoconfigure.metrics.export.jmx.JmxMetricsExportAutoConfiguration,\
|
||||
org.springframework.boot.actuate.autoconfigure.metrics.export.kairos.KairosMetricsExportAutoConfiguration,\
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright 2012-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics.export.humio;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.micrometer.core.instrument.Clock;
|
||||
import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics;
|
||||
import io.micrometer.humio.HumioConfig;
|
||||
import io.micrometer.humio.HumioMeterRegistry;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
/**
|
||||
* Tests for {@link HumioMetricsExportAutoConfiguration}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class HumioMetricsExportAutoConfigurationTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(
|
||||
AutoConfigurations.of(HumioMetricsExportAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
public void backsOffWithoutAClock() {
|
||||
this.contextRunner.run((context) -> assertThat(context)
|
||||
.doesNotHaveBean(HumioMeterRegistry.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfiguresConfigAndMeterRegistry() {
|
||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||
.run((context) -> assertThat(context)
|
||||
.hasSingleBean(HumioMeterRegistry.class)
|
||||
.hasSingleBean(HumioConfig.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigurationCanBeDisabled() {
|
||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||
.withPropertyValues("management.metrics.export.humio.enabled=false")
|
||||
.run((context) -> assertThat(context)
|
||||
.doesNotHaveBean(HumioMeterRegistry.class)
|
||||
.doesNotHaveBean(HumioConfig.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allowsCustomConfigToBeUsed() {
|
||||
this.contextRunner.withUserConfiguration(CustomConfigConfiguration.class)
|
||||
.run((context) -> assertThat(context)
|
||||
.hasSingleBean(HumioMeterRegistry.class)
|
||||
.hasSingleBean(HumioConfig.class).hasBean("customConfig"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allowsCustomRegistryToBeUsed() {
|
||||
this.contextRunner.withUserConfiguration(CustomRegistryConfiguration.class)
|
||||
.run((context) -> assertThat(context)
|
||||
.hasSingleBean(HumioMeterRegistry.class).hasBean("customRegistry")
|
||||
.hasSingleBean(HumioConfig.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stopsMeterRegistryWhenContextIsClosed() {
|
||||
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
||||
.run((context) -> {
|
||||
HumioMeterRegistry registry = spyOnDisposableBean(
|
||||
HumioMeterRegistry.class, context);
|
||||
new JvmMemoryMetrics().bindTo(registry);
|
||||
context.close();
|
||||
verify(registry).stop();
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> T spyOnDisposableBean(Class<T> type,
|
||||
AssertableApplicationContext context) {
|
||||
String[] names = context.getBeanNamesForType(type);
|
||||
assertThat(names).hasSize(1);
|
||||
String registryBeanName = names[0];
|
||||
Map<String, Object> disposableBeans = (Map<String, Object>) ReflectionTestUtils
|
||||
.getField(context.getAutowireCapableBeanFactory(), "disposableBeans");
|
||||
Object registryAdapter = disposableBeans.get(registryBeanName);
|
||||
T registry = (T) spy(ReflectionTestUtils.getField(registryAdapter, "bean"));
|
||||
ReflectionTestUtils.setField(registryAdapter, "bean", registry);
|
||||
return registry;
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class BaseConfiguration {
|
||||
|
||||
@Bean
|
||||
public Clock clock() {
|
||||
return Clock.SYSTEM;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import(BaseConfiguration.class)
|
||||
static class CustomConfigConfiguration {
|
||||
|
||||
@Bean
|
||||
public HumioConfig customConfig() {
|
||||
return new HumioConfig() {
|
||||
|
||||
@Override
|
||||
public String get(String k) {
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import(BaseConfiguration.class)
|
||||
static class CustomRegistryConfiguration {
|
||||
|
||||
@Bean
|
||||
public HumioMeterRegistry customRegistry(HumioConfig config, Clock clock) {
|
||||
return new HumioMeterRegistry(config, clock);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright 2012-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics.export.humio;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link HumioPropertiesConfigAdapter}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class HumioPropertiesConfigAdapterTests {
|
||||
|
||||
@Test
|
||||
public void whenApiTokenIsSetAdapterApiTokenReturnsIt() {
|
||||
HumioProperties properties = new HumioProperties();
|
||||
properties.setApiToken("ABC123");
|
||||
assertThat(new HumioPropertiesConfigAdapter(properties).apiToken())
|
||||
.isEqualTo("ABC123");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenPropertiesConnecTimoueIsSetAdapterConnectTimeoutReturnsIt() {
|
||||
HumioProperties properties = new HumioProperties();
|
||||
properties.setConnectTimeout(Duration.ofSeconds(10));
|
||||
assertThat(new HumioPropertiesConfigAdapter(properties).connectTimeout())
|
||||
.isEqualTo(Duration.ofSeconds(10));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenPropertiesRepositoryIsSetAdapterRepositoryReturnsIt() {
|
||||
HumioProperties properties = new HumioProperties();
|
||||
properties.setRepository("test");
|
||||
assertThat(new HumioPropertiesConfigAdapter(properties).repository())
|
||||
.isEqualTo("test");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenPropertiesTagsIsSetAdapterTagsReturnsIt() {
|
||||
HumioProperties properties = new HumioProperties();
|
||||
properties.setTags(Collections.singletonMap("name", "test"));
|
||||
assertThat(new HumioPropertiesConfigAdapter(properties).tags())
|
||||
.isEqualTo(Collections.singletonMap("name", "test"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenPropertiesUriIsSetAdapterUriReturnsIt() {
|
||||
HumioProperties properties = new HumioProperties();
|
||||
properties.setUri("https://humio.example.com");
|
||||
assertThat(new HumioPropertiesConfigAdapter(properties).uri())
|
||||
.isEqualTo("https://humio.example.com");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2012-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics.export.humio;
|
||||
|
||||
import io.micrometer.humio.HumioConfig;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.StepRegistryPropertiesTests;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link HumioProperties}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class HumioPropertiesTests extends StepRegistryPropertiesTests {
|
||||
|
||||
@Override
|
||||
public void defaultValuesAreConsistent() {
|
||||
HumioProperties properties = new HumioProperties();
|
||||
HumioConfig config = (key) -> null;
|
||||
assertStepRegistryDefaultValues(properties, config);
|
||||
assertThat(properties.getApiToken()).isEqualTo(config.apiToken());
|
||||
assertThat(properties.getRepository()).isEqualTo(config.repository());
|
||||
assertThat(properties.getTags()).isEmpty();
|
||||
assertThat(config.tags()).isNull();
|
||||
assertThat(properties.getUri()).isEqualTo(config.uri());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -938,6 +938,11 @@
|
||||
<artifactId>micrometer-registry-graphite</artifactId>
|
||||
<version>${micrometer.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-humio</artifactId>
|
||||
<version>${micrometer.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-influx</artifactId>
|
||||
|
||||
@@ -236,6 +236,11 @@
|
||||
<artifactId>micrometer-registry-graphite</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-humio</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-influx</artifactId>
|
||||
|
||||
@@ -1447,6 +1447,16 @@ content into your application. Rather, pick only the properties that you need.
|
||||
management.metrics.export.graphite.rate-units=seconds # Base time unit used to report rates.
|
||||
management.metrics.export.graphite.step=1m # Step size (i.e. reporting frequency) to use.
|
||||
management.metrics.export.graphite.tags-as-prefix= # For the default naming convention, turn the specified tag keys into part of the metric prefix.
|
||||
management.metrics.export.humio.api-token= # Humio API token.
|
||||
management.metrics.export.humio.batch-size=10000 # Number of measurements per request to use for this backend. If more measurements are found, then multiple requests will be made.
|
||||
management.metrics.export.humio.connect-timeout=5s # Connection timeout for requests to this backend.
|
||||
management.metrics.export.humio.enabled=true # Whether exporting of metrics to this backend is enabled.
|
||||
management.metrics.export.humio.num-threads=2 # Number of threads to use with the metrics publishing scheduler.
|
||||
management.metrics.export.humio.read-timeout=10s # Read timeout for requests to this backend.
|
||||
management.metrics.export.humio.repository=sandbox # Name of the repository to publish metrics to.
|
||||
management.metrics.export.humio.step=1m # Step size (i.e. reporting frequency) to use.
|
||||
management.metrics.export.humio.tags.*= # Humio tags describing the data source in which metrics will be stored. Humio tags are a distinct concept from Micrometer's tags. Micrometer's tags are used to divide metrics along dimensional boundaries.
|
||||
management.metrics.export.humio.uri=https://cloud.humio.com # URI to ship metrics to. If you need to publish metrics to an internal proxy en-route to Humio, you can define the location of the proxy with this.
|
||||
management.metrics.export.influx.auto-create-db=true # Whether to create the Influx database if it does not exist before attempting to publish metrics to it.
|
||||
management.metrics.export.influx.batch-size=10000 # Number of measurements per request to use for this backend. If more measurements are found, then multiple requests will be made.
|
||||
management.metrics.export.influx.compressed=true # Whether to enable GZIP compression of metrics batches published to Influx.
|
||||
|
||||
@@ -1350,6 +1350,7 @@ monitoring systems, including:
|
||||
- <<production-ready-metrics-export-dynatrace,Elastic>>
|
||||
- <<production-ready-metrics-export-ganglia,Ganglia>>
|
||||
- <<production-ready-metrics-export-graphite,Graphite>>
|
||||
- <<production-ready-metrics-export-humio,Humio>>
|
||||
- <<production-ready-metrics-export-influx,Influx>>
|
||||
- <<production-ready-metrics-export-jmx,JMX>>
|
||||
- <<production-ready-metrics-export-kairos,KairosDB>>
|
||||
@@ -1544,6 +1545,28 @@ public GraphiteMeterRegistry graphiteMeterRegistry(GraphiteConfig config, Clock
|
||||
|
||||
|
||||
|
||||
[[production-ready-metrics-export-humio]]
|
||||
==== Humio
|
||||
By default, the Humio registry pushes metrics to https://cloud.humio.com periodically. To
|
||||
export metrics to SaaS {micrometer-registry-documentation}/humio[Humio], your API token
|
||||
must be provided:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.metrics.export.humio.api-token=YOUR_TOKEN
|
||||
----
|
||||
|
||||
You should also configure one or more tags to identify the data source to which metrics
|
||||
will be pushed:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.metrics.export.humio.tags.alpha=a
|
||||
management.metrics.export.humio.tags.bravo=b
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[production-ready-metrics-export-influx]]
|
||||
==== Influx
|
||||
By default, metrics are exported to {micrometer-registry-documentation}/influx[Influx]
|
||||
|
||||
Reference in New Issue
Block a user