$ mn create-app my-app --features micrometer-atlas
Table of Contents
Micronaut Micrometer
Provides integration between Micronaut and Micrometer
Version: 5.9.3
1 Introduction
This project integrates Micronaut and Micrometer, allowing metrics collection for Micronaut applications.
2 Release History
You can find a list of releases for this project (with release notes) here:
3 Metrics Endpoint
Using the CLI
If you are creating your project using the Micronaut CLI, supply one of |
The metrics endpoint returns information about the "metrics" of the application. To execute the endpoint, send a GET request to /metrics
. This returns the metric names registered with the MeterRegistry
bean.
You can get specific metrics by using /metrics/[name]
, for example /metrics/jvm.memory.used
. This would return something like:
{
"name": "jvm.memory.used",
"measurements": [
{
"statistic": "VALUE",
"value": 1.45397552E8
}
],
"availableTags": [
{
"tag": "area",
"values": [
"heap",
"nonheap"
]
},
{
"tag": "id",
"values": [
"Compressed Class Space",
"PS Survivor Space",
"PS Old Gen",
"Metaspace",
"PS Eden Space",
"Code Cache"
]
}
]
}
You can further limit the metric by using a tag like /metrics/jvm.memory.used?tag=id:PS%20Old%20Gen
.
{
"name": "jvm.memory.used",
"measurements": [
{
"statistic": "VALUE",
"value": 1.1434488E7
}
],
"availableTags": [
{
"tag": "area",
"values": [
"heap"
]
}
]
}
You may even use multiple or nested tags, for example /metrics/jvm.memory.used?tag=id:PS%20Old%20Gen&tag=area:heap
.
{
"name": "jvm.memory.used",
"measurements": [
{
"statistic": "VALUE",
"value": 1.1434488E7
}
]
}
Configuration
Currently, the metrics endpoint is only enabled if you include the micrometer-core
(or one of the typed registries such as micrometer-registry-statsd
, micrometer-registry-graphite
, etc.) AND the management
dependencies. You must also enable the global metrics flag (true
by default).
micronaut.metrics.enabled=true
micronaut:
metrics:
enabled: true
[micronaut]
[micronaut.metrics]
enabled=true
micronaut {
metrics {
enabled = true
}
}
{
micronaut {
metrics {
enabled = true
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true
}
}
}
dependencies {
...
implementation "io.micronaut.micrometer:micronaut-micrometer-core"
// micrometer-registry-statsd also pulls in micrometer-core so included above to verbose example
implementation "io.micronaut.micrometer:micronaut-micrometer-registry-statsd"
// Also required to enable endpoint
implementation "io.micronaut:micronaut-management"
...
}
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-core</artifactId>
<version>${micronaut.version}</version>
</dependency>
<!-- micrometer-registry-statsd also pulls in micrometer-core so included above to verbose example -->
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-statsd</artifactId>
<version>${micronaut.version}</version>
</dependency>
<!-- Also required to enable endpoint -->
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-management</artifactId>
<version>${micronaut.version}</version>
</dependency>
To configure the metrics endpoint, supply configuration through endpoints.metrics
.
endpoints.metrics.enabled=Boolean
endpoints.metrics.sensitive=Boolean
endpoints:
metrics:
enabled: Boolean
sensitive: Boolean
[endpoints]
[endpoints.metrics]
enabled="Boolean"
sensitive="Boolean"
endpoints {
metrics {
enabled = "Boolean"
sensitive = "Boolean"
}
}
{
endpoints {
metrics {
enabled = "Boolean"
sensitive = "Boolean"
}
}
}
{
"endpoints": {
"metrics": {
"enabled": "Boolean",
"sensitive": "Boolean"
}
}
}
4 Metrics Concepts
Metric Concepts
Key Micrometer concepts include a MeterRegistry to register and use meters. A Meter is something that produces metrics.
A MeterRegistry can have some customizations automatically applied.
Meter Registry Configurer
-
Any bean that implements
MeterRegistryConfigurer
gets applied to every applicable MeterRegistry bean on creation -
The implementation of the MeterRegistryConfigurer
supports()
method determines if the configurer is applied to a particular registry-
If you want all registries to get the customization, return
true
-
Otherwise, you can evaluate the registry for its class type, class hierarchy, or other criteria.
-
Remember you only get one shot for autoconfiguration; i.e. when the bean context is started.
-
However, in code you can apply additional customizations to the registry config.
-
/*
* Copyright 2017-2019 original 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
*
* https://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 io.micronaut.configuration.metrics.aggregator;
import io.micrometer.core.instrument.MeterRegistry;
/**
* Configures meter registries. This is done on bean added event so composite
* registry can be skipped and non-composite registries can be added to composite.
*
* @author Christian Oestreich
* @param <T> an instance of a meter registry that will be configured
* @since 1.0
*/
public interface MeterRegistryConfigurer<T extends MeterRegistry> {
/**
* Configures a meter registry with binders, filters, etc.
*
* @param meterRegistry Meter Registry
*/
void configure(T meterRegistry);
/**
* Determines if this configurer supports the meter registry type.
*
* @param meterRegistry a meter registry
* @return boolean whether is supported
*/
default boolean supports(T meterRegistry) {
return true;
}
/**
* @return the type parameter
*/
Class<T> getType();
}
/*
* Copyright 2017-2019 original 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
*
* https://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 io.micronaut.docs;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import io.micronaut.configuration.metrics.aggregator.MeterRegistryConfigurer;
import io.micronaut.configuration.metrics.annotation.RequiresMetrics;
import io.micronaut.core.annotation.Order;
import io.micronaut.core.order.Ordered;
import jakarta.inject.Singleton;
@Order(Integer.MAX_VALUE)
@Singleton
@RequiresMetrics
public class SimpleMeterRegistryConfigurer implements MeterRegistryConfigurer<SimpleMeterRegistry>, Ordered {
@Override
public void configure(SimpleMeterRegistry meterRegistry) {
meterRegistry.config().commonTags("key", "value");
}
@Override
public Class<SimpleMeterRegistry> getType() {
return SimpleMeterRegistry.class;
}
}
Meter Filter
-
A meter filter can be used to determine if a Meter is to be added to the registry.
-
Any bean that implements
MeterFilter
will be applied to all registries when the registry is first created
You can create custom filters similar to the following inside your application. MeterFilter
provides several convenience methods to help with the creation of these filters.
package io.micronaut.docs;
import io.micrometer.core.instrument.Tag;
import io.micrometer.core.instrument.config.MeterFilter;
import io.micronaut.context.annotation.Bean;
import io.micronaut.context.annotation.Factory;
import jakarta.inject.Singleton;
import java.util.Collections;
@Factory
public class MeterFilterFactory {
/**
* Add global tags to all metrics.
*
* @return meter filter
*/
@Bean
@Singleton
MeterFilter addCommonTagFilter() {
return MeterFilter.commonTags(Collections.singletonList(Tag.of("scope", "demo")));
}
/**
* Rename a tag key for every metric beginning with a given prefix.
* <p>
* This will rename the metric name http.server.requests tag value called `method` to `httpmethod`
* <p>
* OLD: http.server.requests ['method':'GET", ...]
* NEW: http.server.requests ['httpmethod':'GET", ...]
*
* @return meter filter
*/
@Bean
@Singleton
MeterFilter renameFilter() {
return MeterFilter.renameTag("http.server.requests", "method", "httpmethod");
}
}
Meter Binder
Meter Binders get applied to Meter Registry to mix in metrics producers. Micrometer defines several of these for cross-cutting metrics related to JVM metrics, caches, classloaders, etc. These implement MeterBinder
, but they are not autowired as beans; manual wiring is required given how Micrometer is currently implemented.
Provided Binders
The following metrics currently have binders and are enabled by default. The settings listed below can disable individual metric binders if you do not wish to collect or report those metrics.
JVM Metrics
The JVM metrics bindings provide several JVM metrics.
Control Property: micronaut.metrics.binders.jvm.enabled
Name |
jvm.buffer.count |
jvm.buffer.memory.used |
jvm.buffer.total.capacity |
jvm.classes.loaded |
jvm.classes.unloaded |
jvm.gc.live.data.size |
jvm.gc.max.data.size |
jvm.gc.memory.allocated |
jvm.gc.memory.promoted |
jvm.memory.committed |
jvm.memory.max |
jvm.memory.used |
jvm.threads.daemon |
jvm.threads.live |
jvm.threads.peak |
Web Metrics
There is a default web filter provided for web metrics. All routes, status codes, methods, and exceptions are timed and counted.
Control Property: micronaut.metrics.binders.web.enabled
If enabled, by default the path /**
is intercepted. To change which paths are run through the filter for the server, set micronaut.metrics.http.path
. For the client, set micronaut.metrics.http.client.path
.
By default, client URIs are captured when an error is handled.
This can cause trouble in some monitoring tools due to a large amount of distinct URIs captured.
This URI capturing can be disabled by setting micronaut.metrics.binders.web.client-errors-uris.enabled
to false
.
The web metrics can be configured to enable percentiles, histogram, service level objectives and the expected min and max duration of the requests. All configurations can be added to HTTP server and client metrics. All time configurations are specified in seconds.
A complete example:
micronaut.metrics.binders.web.server.percentiles=0.95,0.99
micronaut.metrics.binders.web.server.histogram=true
micronaut.metrics.binders.web.server.slos=0.1,0.4,0.5,2
micronaut.metrics.binders.web.server.min=0.1
micronaut.metrics.binders.web.server.max=60
micronaut.metrics.binders.web.client.percentiles=0.95,0.99
micronaut.metrics.binders.web.client.histogram=true
micronaut.metrics.binders.web.client.slos=0.1,0.4,0.5,2
micronaut.metrics.binders.web.client.min=0.1
micronaut.metrics.binders.web.client.max=60
micronaut:
metrics:
binders:
web:
server:
percentiles: "0.95,0.99"
histogram: true
slos: "0.1,0.4,0.5,2"
min: 0.1
max: 60
client:
percentiles: "0.95,0.99"
histogram: true
slos: "0.1,0.4,0.5,2"
min: 0.1
max: 60
[micronaut]
[micronaut.metrics]
[micronaut.metrics.binders]
[micronaut.metrics.binders.web]
[micronaut.metrics.binders.web.server]
percentiles="0.95,0.99"
histogram=true
slos="0.1,0.4,0.5,2"
min=0.1
max=60
[micronaut.metrics.binders.web.client]
percentiles="0.95,0.99"
histogram=true
slos="0.1,0.4,0.5,2"
min=0.1
max=60
micronaut {
metrics {
binders {
web {
server {
percentiles = "0.95,0.99"
histogram = true
slos = "0.1,0.4,0.5,2"
min = 0.1
max = 60
}
client {
percentiles = "0.95,0.99"
histogram = true
slos = "0.1,0.4,0.5,2"
min = 0.1
max = 60
}
}
}
}
}
{
micronaut {
metrics {
binders {
web {
server {
percentiles = "0.95,0.99"
histogram = true
slos = "0.1,0.4,0.5,2"
min = 0.1
max = 60
}
client {
percentiles = "0.95,0.99"
histogram = true
slos = "0.1,0.4,0.5,2"
min = 0.1
max = 60
}
}
}
}
}
}
{
"micronaut": {
"metrics": {
"binders": {
"web": {
"server": {
"percentiles": "0.95,0.99",
"histogram": true,
"slos": "0.1,0.4,0.5,2",
"min": 0.1,
"max": 60
},
"client": {
"percentiles": "0.95,0.99",
"histogram": true,
"slos": "0.1,0.4,0.5,2",
"min": 0.1,
"max": 60
}
}
}
}
}
}
Name |
http.server.requests |
http.client.requests |
System Metrics
There are multiple metrics that can be separately toggled.
Uptime Metrics
The uptime metrics bindings provide system uptime metrics.
Control Property: micronaut.metrics.binders.uptime.enabled
Name |
process.uptime |
process.start.time |
Processor Metrics
The processor metrics bindings provide system processor metrics.
Control Property: micronaut.metrics.binders.processor.enabled
Name |
system.load.average.1m |
system.cpu.usage |
system.cpu.count |
process.cpu.usage |
File Descriptor Metrics
The file descriptor metrics bindings provide system file descriptor metrics.
Control Property: micronaut.metrics.binders.files.enabled
Name |
process.files.open |
process.files.max |
Logback Metrics
The logging metrics bindings provide logging metrics if using Logback.
Control Property: micronaut.metrics.binders.logback.enabled
Name |
logback.events |
Hibernate Metrics
You can enable metrics for Hibernate by setting the hibernate.generate_statistics
property to true
in configuration. For example, for the default entity manager:
Enabling Hibernate Metrics
jpa.default.properties.hibernate.generate_statistics=true
jpa:
default:
properties:
hibernate:
generate_statistics: true
[jpa]
[jpa.default]
[jpa.default.properties]
[jpa.default.properties.hibernate]
generate_statistics=true
jpa {
'default' {
properties {
hibernate {
generate_statistics = true
}
}
}
}
{
jpa {
default {
properties {
hibernate {
generate_statistics = true
}
}
}
}
}
{
"jpa": {
"default": {
"properties": {
"hibernate": {
"generate_statistics": true
}
}
}
}
}
HibernateMetrics needs to be on the classpath, so hibernate-micrometer should be downloaded:
dependencies {
...
implementation("org.hibernate:hibernate-micrometer")
...
}
Micrometer automatically exposes Hibernate statistics. See the source code for HibernateMetrics for the available metrics.
DataSource Metrics
The DataSource
metrics bindings provide data source pool metrics.
Control Property: micronaut.metrics.binders.jdbc.enabled
There is a different set of pool metric names for HikariCP and other pool providers. |
If you use io.micronaut.sql:micronaut-jdbc-hikari
you will get additional pool metrics, as HikariCP has built-in support for meter registries.
Name |
hikaricp.connections.idle |
hikaricp.connections.pending |
hikaricp.connections |
hikaricp.connections.active |
hikaricp.connections.creation |
hikaricp.connections.max |
hikaricp.connections.min |
hikaricp.connections.usage |
hikaricp.connections.timeout |
hikaricp.connections.acquire |
If you use io.micronaut.sql:micronaut-jdbc-tomcat
or io.micronaut.sql:micronaut-jdbc-dbcp
, you will get the following metrics
Name |
jdbc.connections.usage |
jdbc.connections.active |
jdbc.connections.max |
jdbc.connections.min |
Netty Server Metrics
Currently, the following binders are provided to instrument Netty server:
-
EventLoopGroupFactoryBinder: Instrument and expose event loop group queues metrics; use
micronaut.metrics.binders.netty.queues.enabled
to toggle. Default is false. The queues' size and tasks wait and execution time are exposed. -
ByteBufAllocatorMetricsBinder: Expose
ByteBuf
default allocators (UnpooledByteBufAllocator, PooledByteBufAllocator) metrics; usemicronaut.metrics.binders.netty.bytebuf-allocators.enabled
to toggle. Default is false. You can customize what metrics are exposed usingmicronaut.metrics.binders.netty.bytebuf-allocators.metrics
. By default, all available metrics are exposed. These flags are supported:-
POOLED_ALLOCATOR
: exposePooledByteBufAllocator
metrics, -
UNPOOLED_ALLOCATOR
: exposeUnpooledByteBufAllocator
metrics, -
POOLED_ARENAS
: exposePooledByteBufAllocator
pooled arenas metrics (requiresPOOLED_ALLOCATOR
), -
POOLED_ARENAS_SUBPAGES
: exposePooledByteBufAllocator
pooled arenas sub pages metrics (requiresPOOLED_ARENAS
), -
POOLED_ARENAS_CHUNKLISTS
: exposePooledByteBufAllocator
pooled arenas chunk lists metrics (requiresPOOLED_ARENAS
), -
POOLED_ARENAS_CHUNKS
: exposePooledByteBufAllocator
pooled arenas chunks metrics (requiresPOOLED_ARENAS_CHUNKLISTS
).
-
-
NettyMetricsPipelineBinder: Instrument Netty’s channel, use
micronaut.metrics.binders.netty.channels.enabled
to toggle. Default is false. The provided metrics include the channel count, current active channel count, channel error count, bytes read and written.
Adding Custom Metrics
To add metrics to your application, dependency-inject a MeterRegistry
bean and use the provided methods to access counters, timers, etc.
See the Micrometer docs for more information.
package io.micronaut.docs;
import io.micrometer.core.instrument.MeterRegistry;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import jakarta.validation.constraints.NotBlank;
import reactor.core.publisher.Mono;
@Controller
class IndexController {
private final MeterRegistry meterRegistry;
IndexController(MeterRegistry meterRegistry) {
this.meterRegistry = meterRegistry;
}
@Get("/hello/{name}")
Mono<String> hello(@NotBlank String name) {
meterRegistry
.counter("web.access", "controller", "index", "action", "hello")
.increment();
return Mono.just("Hello " + name);
}
}
Custom Exception Metrics
To report on response codes for custom handled exceptions, implement io.micronaut.http.HttpResponseProvider
.
The default value reported for an ExceptionHandler
is 500.
See the Micronaut docs for more information on ExceptionHandler
.
package io.micronaut.docs;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.HttpResponseProvider;
public class OutOfStockException extends RuntimeException implements HttpResponseProvider {
@Override
public HttpResponse<?> getResponse() {
return HttpResponse.ok(0);
}
}
5 Metrics Annotations
You can use the Micrometer @Timed
and @Counted
annotations on any bean method by adding the micronaut-micrometer-annotation
dependency to your annotation processor classpath:
annotationProcessor("io.micronaut.micrometer:micronaut-micrometer-annotation")
<annotationProcessorPaths>
<path>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-annotation</artifactId>
</path>
</annotationProcessorPaths>
In order to support adding additional tags programmatically similar to Micrometer’s TimedAspect
/ CountedAspect
ability using a ProceedingJoinPoint
, create beans of type AbstractMethodTagger
package io.micronaut.docs;
import io.micrometer.core.instrument.Tag;
import io.micronaut.aop.MethodInvocationContext;
import io.micronaut.configuration.metrics.aggregator.AbstractMethodTagger;
import jakarta.inject.Singleton;
import java.util.Collections;
import java.util.List;
@Singleton
public class MethodNameTagger extends AbstractMethodTagger {
@Override
public List<Tag> buildTags(MethodInvocationContext<Object, Object> context) {
return Collections.singletonList(Tag.of("method", context.getMethodName()));
}
}
6 Metrics Registries & Reporters
Metrics Registries & Reporters
By default, there is a /metrics
endpoint configured, and metrics are provided to it for viewing or retrieving via HTTP. To register a specific type of reporter, include a typed registry configuration. The following are the currently supported libraries for reporting metrics.
6.1 AppOptics Registry
You can include the AppOptics reporter via io.micronaut.micrometer:micronaut-micrometer-registry-appoptics
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-appoptics")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-appoptics</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.appoptics
. The most commonly changed configuration properties are listed below, but see AppOpticsConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter. Could disable to local dev for example. Default: |
apiToken |
AppOptics API token. Required. |
step |
How frequently to report metrics. Default: |
uri |
The URI for the AppOptics backend. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.appoptics.enabled=true
micronaut.metrics.export.appoptics.apiToken=${APPOPTICS_API_TOKEN}
micronaut.metrics.export.appoptics.uri=https://api.appoptics.com/v1/measurements
micronaut.metrics.export.appoptics.step=PT1M
micronaut:
metrics:
enabled: true
export:
appoptics:
enabled: true
apiToken: ${APPOPTICS_API_TOKEN}
uri: https://api.appoptics.com/v1/measurements
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.appoptics]
enabled=true
apiToken="${APPOPTICS_API_TOKEN}"
uri="https://api.appoptics.com/v1/measurements"
step="PT1M"
micronaut {
metrics {
enabled = true
export {
appoptics {
enabled = true
apiToken = "${APPOPTICS_API_TOKEN}"
uri = "https://api.appoptics.com/v1/measurements"
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
appoptics {
enabled = true
apiToken = "${APPOPTICS_API_TOKEN}"
uri = "https://api.appoptics.com/v1/measurements"
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"appoptics": {
"enabled": true,
"apiToken": "${APPOPTICS_API_TOKEN}",
"uri": "https://api.appoptics.com/v1/measurements",
"step": "PT1M"
}
}
}
}
}
6.2 Atlas Registry
You can include the Atlas reporter via io.micronaut.micrometer:micronaut-micrometer-registry-atlas
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-atlas")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-atlas</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.atlas
. The most commonly changed configuration properties are listed below, but see AtlasConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
step |
How frequently to report metrics. Default: |
uri |
The URI for the Atlas backend. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.atlas.enabled=true
micronaut.metrics.export.atlas.uri=http://localhost:7101/api/v1/publish
micronaut.metrics.export.atlas.step=PT1M
micronaut:
metrics:
enabled: true
export:
atlas:
enabled: true
uri: http://localhost:7101/api/v1/publish
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.atlas]
enabled=true
uri="http://localhost:7101/api/v1/publish"
step="PT1M"
micronaut {
metrics {
enabled = true
export {
atlas {
enabled = true
uri = "http://localhost:7101/api/v1/publish"
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
atlas {
enabled = true
uri = "http://localhost:7101/api/v1/publish"
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"atlas": {
"enabled": true,
"uri": "http://localhost:7101/api/v1/publish",
"step": "PT1M"
}
}
}
}
}
6.3 Azure Monitor Registry
You can include the Azure Monitor reporter via io.micronaut.micrometer:micronaut-micrometer-registry-azure-monitor
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-azure-monitor")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-azure-monitor</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.azuremonitor
. The most commonly changed configuration properties are listed below, but see AzureMonitorConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
instrumentationKey |
Azure Monitor instrumentation key. Required. |
step |
How frequently to report metrics. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.azuremonitor.enabled=true
micronaut.metrics.export.azuremonitor.instrumentationKey=${AZUREMONITOR_INSTRUMENTATION_KEY}
micronaut.metrics.export.azuremonitor.step=PT1M
micronaut:
metrics:
enabled: true
export:
azuremonitor:
enabled: true
instrumentationKey: ${AZUREMONITOR_INSTRUMENTATION_KEY}
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.azuremonitor]
enabled=true
instrumentationKey="${AZUREMONITOR_INSTRUMENTATION_KEY}"
step="PT1M"
micronaut {
metrics {
enabled = true
export {
azuremonitor {
enabled = true
instrumentationKey = "${AZUREMONITOR_INSTRUMENTATION_KEY}"
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
azuremonitor {
enabled = true
instrumentationKey = "${AZUREMONITOR_INSTRUMENTATION_KEY}"
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"azuremonitor": {
"enabled": true,
"instrumentationKey": "${AZUREMONITOR_INSTRUMENTATION_KEY}",
"step": "PT1M"
}
}
}
}
}
6.4 CloudWatch Registry
You can include the CloudWatch reporter via io.micronaut.micrometer:micronaut-micrometer-registry-cloudwatch
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-cloudwatch")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-cloudwatch</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.cloudwatch
. The most commonly changed configuration properties are listed below, but see CloudWatchConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
namespace |
Namespace that will be displayed in CloudWatch for these metrics. Default: |
batchSize |
Number of metrics to send in a batch to CloudWatch. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.cloudwatch.enabled=true
micronaut.metrics.export.cloudwatch.namespace=myAwesomeAppMetrics
micronaut.metrics.export.cloudwatch.batchSize=10
micronaut:
metrics:
enabled: true
export:
cloudwatch:
enabled: true
namespace: myAwesomeAppMetrics
batchSize: 10
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.cloudwatch]
enabled=true
namespace="myAwesomeAppMetrics"
batchSize=10
micronaut {
metrics {
enabled = true
export {
cloudwatch {
enabled = true
namespace = "myAwesomeAppMetrics"
batchSize = 10
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
cloudwatch {
enabled = true
namespace = "myAwesomeAppMetrics"
batchSize = 10
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"cloudwatch": {
"enabled": true,
"namespace": "myAwesomeAppMetrics",
"batchSize": 10
}
}
}
}
}
See the guide for Collect Metrics with the Micronaut Framework and Monitor Them on Amazon Cloudwatch to learn more. |
6.5 Datadog Registry
You can include the Datadog reporter via io.micronaut.micrometer:micronaut-micrometer-registry-datadog
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-datadog")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-datadog</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.datadog
. The most commonly changed configuration properties are listed below, but see DatadogConfig for more options.
Name |
Description |
apiKey |
Datadog API Key. Required. |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
step |
How frequently to report metrics. Default: |
descriptions |
Whether meter descriptions should be sent to Datadog. Disable to minimize the amount of data sent on each scrape. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.datadog.apiKey=${DATADOG_APIKEY}
micronaut.metrics.export.datadog.enabled=true
micronaut.metrics.export.datadog.step=PT1M
micronaut:
metrics:
enabled: true
export:
datadog:
apiKey: ${DATADOG_APIKEY}
enabled: true
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.datadog]
apiKey="${DATADOG_APIKEY}"
enabled=true
step="PT1M"
micronaut {
metrics {
enabled = true
export {
datadog {
apiKey = "${DATADOG_APIKEY}"
enabled = true
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
datadog {
apiKey = "${DATADOG_APIKEY}"
enabled = true
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"datadog": {
"apiKey": "${DATADOG_APIKEY}",
"enabled": true,
"step": "PT1M"
}
}
}
}
}
6.6 Dynatrace Registry
You can include the Dynatrace reporter via io.micronaut.micrometer:micronaut-micrometer-registry-dynatrace
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-dynatrace")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-dynatrace</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.dynatrace
. The most commonly changed configuration properties are listed below, but see DynatraceConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
apiToken |
Dynatrace API Token. Required. |
uri |
Dynatrace server URI. Required. |
decideId |
Device ID to be reported. Required. |
step |
How frequently to report metrics. Default: |
descriptions |
Whether meter descriptions should be sent to InfluxDB. Disable to minimize the amount of data sent on each scrape. Default: |
endpoints.prometheus.sensitive=false
micronaut.metrics.enabled=true
micronaut.metrics.export.dynatrace.enabled=true
micronaut.metrics.export.dynatrace.apiToken=${DYNATRACE_DEVICE_API_TOKEN}
micronaut.metrics.export.dynatrace.uri=${DYNATRACE_DEVICE_URI}
micronaut.metrics.export.dynatrace.deviceId=${DYNATRACE_DEVICE_ID}
micronaut.metrics.export.dynatrace.step=PT1M
endpoints:
prometheus:
sensitive: false
micronaut:
metrics:
enabled: true
export:
dynatrace:
enabled: true
apiToken: ${DYNATRACE_DEVICE_API_TOKEN}
uri: ${DYNATRACE_DEVICE_URI}
deviceId: ${DYNATRACE_DEVICE_ID}
step: PT1M
[endpoints]
[endpoints.prometheus]
sensitive=false
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.dynatrace]
enabled=true
apiToken="${DYNATRACE_DEVICE_API_TOKEN}"
uri="${DYNATRACE_DEVICE_URI}"
deviceId="${DYNATRACE_DEVICE_ID}"
step="PT1M"
endpoints {
prometheus {
sensitive = false
}
}
micronaut {
metrics {
enabled = true
export {
dynatrace {
enabled = true
apiToken = "${DYNATRACE_DEVICE_API_TOKEN}"
uri = "${DYNATRACE_DEVICE_URI}"
deviceId = "${DYNATRACE_DEVICE_ID}"
step = "PT1M"
}
}
}
}
{
endpoints {
prometheus {
sensitive = false
}
}
micronaut {
metrics {
enabled = true
export {
dynatrace {
enabled = true
apiToken = "${DYNATRACE_DEVICE_API_TOKEN}"
uri = "${DYNATRACE_DEVICE_URI}"
deviceId = "${DYNATRACE_DEVICE_ID}"
step = "PT1M"
}
}
}
}
}
{
"endpoints": {
"prometheus": {
"sensitive": false
}
},
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"dynatrace": {
"enabled": true,
"apiToken": "${DYNATRACE_DEVICE_API_TOKEN}",
"uri": "${DYNATRACE_DEVICE_URI}",
"deviceId": "${DYNATRACE_DEVICE_ID}",
"step": "PT1M"
}
}
}
}
}
6.7 Elasticsearch Registry
You can include the Elasticsearch reporter via io.micronaut.micrometer:micronaut-micrometer-registry-elastic
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-elastic")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-elastic</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.elastic
. The most commonly changed configuration properties are listed below, but see ElasticConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
step |
How frequently to report metrics. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.elastic.enabled=true
micronaut.metrics.export.elastic.step=PT1M
micronaut:
metrics:
enabled: true
export:
elastic:
enabled: true
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.elastic]
enabled=true
step="PT1M"
micronaut {
metrics {
enabled = true
export {
elastic {
enabled = true
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
elastic {
enabled = true
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"elastic": {
"enabled": true,
"step": "PT1M"
}
}
}
}
}
6.8 Ganglia Registry
You can include the Ganglia reporter via io.micronaut.micrometer:micronaut-micrometer-registry-ganglia
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-ganglia")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-ganglia</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.ganglia
. The most commonly changed configuration properties are listed below, but see GangliaConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
protocolVersion |
Ganglia protocol version ( |
step |
How frequently to report metrics. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.ganglia.enabled=true
micronaut.metrics.export.ganglia.protocolVersion=3.1
micronaut.metrics.export.ganglia.step=PT1M
micronaut:
metrics:
enabled: true
export:
ganglia:
enabled: true
protocolVersion: 3.1
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.ganglia]
enabled=true
protocolVersion=3.1
step="PT1M"
micronaut {
metrics {
enabled = true
export {
ganglia {
enabled = true
protocolVersion = 3.1
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
ganglia {
enabled = true
protocolVersion = 3.1
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"ganglia": {
"enabled": true,
"protocolVersion": 3.1,
"step": "PT1M"
}
}
}
}
}
6.9 Graphite Registry
You can include the Graphite reporter via io.micronaut.micrometer:micronaut-micrometer-registry-graphite
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-graphite")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-graphite</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.graphite
. The most commonly changed configuration properties are listed below, but see GraphiteConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
step |
How frequently to report metrics. Default: |
host |
The Graphite server location. Default: |
port |
The Graphite server port. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.graphite.enabled=true
micronaut.metrics.export.graphite.step=PT1M
micronaut.metrics.export.graphite.host=localhost
micronaut.metrics.export.graphite.port=2004
micronaut:
metrics:
enabled: true
export:
graphite:
enabled: true
step: PT1M
host: localhost
port: 2004
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.graphite]
enabled=true
step="PT1M"
host="localhost"
port=2004
micronaut {
metrics {
enabled = true
export {
graphite {
enabled = true
step = "PT1M"
host = "localhost"
port = 2004
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
graphite {
enabled = true
step = "PT1M"
host = "localhost"
port = 2004
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"graphite": {
"enabled": true,
"step": "PT1M",
"host": "localhost",
"port": 2004
}
}
}
}
}
6.10 Humio Registry
You can include the Humio reporter via io.micronaut.micrometer:micronaut-micrometer-registry-humio
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-humio")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-humio</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.humio
. The most commonly changed configuration properties are listed below, but see HumioConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
step |
How frequently to report metrics. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.humio.enabled=true
micronaut.metrics.export.humio.step=PT1M
micronaut:
metrics:
enabled: true
export:
humio:
enabled: true
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.humio]
enabled=true
step="PT1M"
micronaut {
metrics {
enabled = true
export {
humio {
enabled = true
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
humio {
enabled = true
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"humio": {
"enabled": true,
"step": "PT1M"
}
}
}
}
}
6.11 Influx Registry
You can include the Influx reporter via io.micronaut.micrometer:micronaut-micrometer-registry-influx
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-influx")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-influx</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.influx
. The most commonly changed configuration properties are listed below, but see InfluxConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
step |
How frequently to report metrics. Default: |
descriptions |
Whether meter descriptions should be sent to InfluxDB. Disable to minimize the amount of data sent on each scrape. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.influx.enabled=true
micronaut.metrics.export.influx.step=PT1M
micronaut:
metrics:
enabled: true
export:
influx:
enabled: true
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.influx]
enabled=true
step="PT1M"
micronaut {
metrics {
enabled = true
export {
influx {
enabled = true
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
influx {
enabled = true
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"influx": {
"enabled": true,
"step": "PT1M"
}
}
}
}
}
6.12 JMX Registry
You can include the JMX reporter via io.micronaut.micrometer:micronaut-micrometer-jmx
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-jmx")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-jmx</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.jmx
. The most commonly changed configuration properties are listed below, but see JmxConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
step |
How frequently to report metrics. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.jmx.enabled=true
micronaut.metrics.export.jmx.step=PT1M
micronaut:
metrics:
enabled: true
export:
jmx:
enabled: true
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.jmx]
enabled=true
step="PT1M"
micronaut {
metrics {
enabled = true
export {
jmx {
enabled = true
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
jmx {
enabled = true
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"jmx": {
"enabled": true,
"step": "PT1M"
}
}
}
}
}
6.13 Kairos Registry
You can include the Kairos reporter via io.micronaut.micrometer:micronaut-micrometer-registry-kairos
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-kairos")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-kairos</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.kairos
. The most commonly changed configuration properties are listed below, but see KairosConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
uri |
Kairos server URI. Required. |
step |
How frequently to report metrics. Default: |
descriptions |
Whether meter descriptions should be sent to InfluxDB. Disable to minimize the amount of data sent on each scrape. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.kairos.enabled=true
micronaut.metrics.export.kairos.uri=http://localhost:8080/api/v1/datapoints
micronaut.metrics.export.kairos.step=PT1M
micronaut:
metrics:
enabled: true
export:
kairos:
enabled: true
uri: http://localhost:8080/api/v1/datapoints
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.kairos]
enabled=true
uri="http://localhost:8080/api/v1/datapoints"
step="PT1M"
micronaut {
metrics {
enabled = true
export {
kairos {
enabled = true
uri = "http://localhost:8080/api/v1/datapoints"
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
kairos {
enabled = true
uri = "http://localhost:8080/api/v1/datapoints"
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"kairos": {
"enabled": true,
"uri": "http://localhost:8080/api/v1/datapoints",
"step": "PT1M"
}
}
}
}
}
6.14 New Relic Registry
You can include the New Relic reporter via io.micronaut.micrometer:micronaut-micrometer-registry-new-relic
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-new-relic")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-new-relic</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.newrelic
. The most commonly changed configuration properties are listed below, but see NewRelicConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
apiKey |
New Relic API key. Required. |
accountId |
New Relic account ID. Required. |
step |
How frequently to report metrics. Default: |
descriptions |
Whether meter descriptions should be sent to InfluxDB. Disable to minimize the amount of data sent on each scrape. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.newrelic.enabled=true
micronaut.metrics.export.newrelic.apiKey=${NEWRELIC_API_KEY}
micronaut.metrics.export.newrelic.accountId=${NEWRELIC_ACCOUNT_ID}
micronaut.metrics.export.newrelic.step=PT1M
micronaut:
metrics:
enabled: true
export:
newrelic:
enabled: true
apiKey: ${NEWRELIC_API_KEY}
accountId: ${NEWRELIC_ACCOUNT_ID}
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.newrelic]
enabled=true
apiKey="${NEWRELIC_API_KEY}"
accountId="${NEWRELIC_ACCOUNT_ID}"
step="PT1M"
micronaut {
metrics {
enabled = true
export {
newrelic {
enabled = true
apiKey = "${NEWRELIC_API_KEY}"
accountId = "${NEWRELIC_ACCOUNT_ID}"
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
newrelic {
enabled = true
apiKey = "${NEWRELIC_API_KEY}"
accountId = "${NEWRELIC_ACCOUNT_ID}"
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"newrelic": {
"enabled": true,
"apiKey": "${NEWRELIC_API_KEY}",
"accountId": "${NEWRELIC_ACCOUNT_ID}",
"step": "PT1M"
}
}
}
}
}
6.15 New Relic Telemetry Registry
A New Relic Registry using New Relic’s own Micrometer Registry rather than the New Relic registry provided by the Micrometer project.
You can include the New Relic Telemetry reporter via io.micronaut.micrometer:micronaut-micrometer-registry-new-relic-telemetry
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-new-relic-telemetry")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-new-relic-telemetry</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.newrelic
. The most commonly changed configuration properties are listed below, but see NewRelicRegistryConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
apiKey |
New Relic API key. Required. |
serviceName |
The service name this registry will report as in New Relic. |
step |
How frequently to report metrics. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.newrelic.enabled=true
micronaut.metrics.export.newrelic.apiKey=${NEWRELIC_API_KEY}
micronaut.metrics.export.newrelic.serviceName=My Micronaut Service
micronaut.metrics.export.newrelic.step=PT1M
micronaut:
metrics:
enabled: true
export:
newrelic:
enabled: true
apiKey: ${NEWRELIC_API_KEY}
serviceName: My Micronaut Service
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.newrelic]
enabled=true
apiKey="${NEWRELIC_API_KEY}"
serviceName="My Micronaut Service"
step="PT1M"
micronaut {
metrics {
enabled = true
export {
newrelic {
enabled = true
apiKey = "${NEWRELIC_API_KEY}"
serviceName = "My Micronaut Service"
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
newrelic {
enabled = true
apiKey = "${NEWRELIC_API_KEY}"
serviceName = "My Micronaut Service"
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"newrelic": {
"enabled": true,
"apiKey": "${NEWRELIC_API_KEY}",
"serviceName": "My Micronaut Service",
"step": "PT1M"
}
}
}
}
}
6.16 Oracle Cloud Monitoring Registry
The OCI Monitoring service enables you to actively and passively monitor your cloud resources using the Metrics and Alarms features on Oracle Cloud.
To configure the module see the documentation for Micrometer Support For Oracle Monitoring in the Oracle Cloud module.
See the guide for Collect Metrics with the Micronaut Framework and Monitor Them on Oracle Cloud to learn more. |
6.17 OTLP Registry
You can include the OTLP reporter via io.micronaut.micrometer:micronaut-micrometer-registry-otlp
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-otlp")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-otlp</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.otlp
. The most commonly changed configuration properties are listed below, but see OtlpConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
url |
Address where metrics will be published. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.otlp.enabled=true
micronaut.metrics.export.otlp.url=http://otel-collector:4318/v1/metrics
micronaut:
metrics:
enabled: true
export:
otlp:
enabled: true
url: http://otel-collector:4318/v1/metrics
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.otlp]
enabled=true
url="http://otel-collector:4318/v1/metrics"
micronaut {
metrics {
enabled = true
export {
otlp {
enabled = true
url = "http://otel-collector:4318/v1/metrics"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
otlp {
enabled = true
url = "http://otel-collector:4318/v1/metrics"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"otlp": {
"enabled": true,
"url": "http://otel-collector:4318/v1/metrics"
}
}
}
}
}
6.18 Prometheus Registry
You can include the Prometheus reporter via io.micronaut.micrometer:micronaut-micrometer-registry-prometheus
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-prometheus")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-prometheus</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.prometheus
. The most commonly changed configuration properties are listed below, but see PrometheusConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
step |
How frequently to report metrics. Default: |
descriptions |
Whether meter descriptions should be sent to Prometheus. Disable to minimize the amount of data sent on each scrape. Default: |
endpoints.prometheus.sensitive=false
micronaut.metrics.enabled=true
micronaut.metrics.export.prometheus.enabled=true
micronaut.metrics.export.prometheus.step=PT1M
micronaut.metrics.export.prometheus.descriptions=true
endpoints:
prometheus:
sensitive: false
micronaut:
metrics:
enabled: true
export:
prometheus:
enabled: true
step: PT1M
descriptions: true
[endpoints]
[endpoints.prometheus]
sensitive=false
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.prometheus]
enabled=true
step="PT1M"
descriptions=true
endpoints {
prometheus {
sensitive = false
}
}
micronaut {
metrics {
enabled = true
export {
prometheus {
enabled = true
step = "PT1M"
descriptions = true
}
}
}
}
{
endpoints {
prometheus {
sensitive = false
}
}
micronaut {
metrics {
enabled = true
export {
prometheus {
enabled = true
step = "PT1M"
descriptions = true
}
}
}
}
}
{
"endpoints": {
"prometheus": {
"sensitive": false
}
},
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"prometheus": {
"enabled": true,
"step": "PT1M",
"descriptions": true
}
}
}
}
}
IMPORTANT NOTE: Once configured, the Prometheus-compatible metrics can be accessed from the path /prometheus
. By default, Prometheus looks for /metrics
, but that path serves the core Micronaut metrics, hence the need to point to /prometheus
.
Prometheus Default Metrics
By default, there is a set of metrics that are exposed by the different binders. If you include the Prometheus reporter, those metrics will be available in Prometheus format as well.
Here you will find the definition of all default metrics exposed by a binder.
Web Metrics
Name |
Description |
http_client_requests_seconds_count |
Total number of requests per second your application made to an endpoint via HTTP Client interface |
http_client_requests_seconds_sum |
Sum of the duration of every request your application made to an endpoint via HTTP Client interface |
http_client_requests_seconds_max |
Maximum request duration during a time window. The value resets to 0 when a new time window starts. The default time window is two minutes. |
http_server_requests_seconds_count |
Total number of requests your application received at an endpoint |
http_server_requests_seconds_sum |
Sum of the duration of every request your application received at an endpoint |
http_server_requests_seconds_max |
Maximum request duration during a time window. The value resets to 0 when a new time window starts. The default time window is two minutes |
6.19 Prometheus PushGateway
You can include the Prometheus Pushgateway reporter via io.micronaut.micrometer:micronaut-micrometer-registry-prometheus-pushgateway
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-prometheus-pushgateway")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-prometheus-pushgateway</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.prometheus.pushgateway
.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
interval |
How frequently to push metrics data. Default: |
address |
Address of the Pushgateway in format host:port. Default is |
format |
Default is |
scheme |
Specify if metrics should be pushed using HTTP or HTTPS. Default is HTTP. |
job |
The job label to be used when pushing metrics. |
basic-auth-username |
Username for basic auth |
basic-auth-password |
Password for basic auth |
grouping-keys |
Grouping keys to be used when pushing/deleting metrics. |
endpoints.prometheus.sensitive=false
micronaut.metrics.enabled=true
micronaut.metrics.export.prometheus.enabled=true
micronaut.metrics.export.prometheus.step=PT1M
micronaut.metrics.export.prometheus.descriptions=true
micronaut.metrics.export.prometheus.pushgateway.enabled=true
micronaut.metrics.export.prometheus.pushgateway.address=localhost:9091
micronaut.metrics.export.prometheus.pushgateway.interval=PT1M
endpoints:
prometheus:
sensitive: false
micronaut:
metrics:
enabled: true
export:
prometheus:
enabled: true
step: PT1M
descriptions: true
pushgateway:
enabled: true
address: localhost:9091
interval: PT1M
[endpoints]
[endpoints.prometheus]
sensitive=false
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.prometheus]
enabled=true
step="PT1M"
descriptions=true
[micronaut.metrics.export.prometheus.pushgateway]
enabled=true
address="localhost:9091"
interval="PT1M"
endpoints {
prometheus {
sensitive = false
}
}
micronaut {
metrics {
enabled = true
export {
prometheus {
enabled = true
step = "PT1M"
descriptions = true
pushgateway {
enabled = true
address = "localhost:9091"
interval = "PT1M"
}
}
}
}
}
{
endpoints {
prometheus {
sensitive = false
}
}
micronaut {
metrics {
enabled = true
export {
prometheus {
enabled = true
step = "PT1M"
descriptions = true
pushgateway {
enabled = true
address = "localhost:9091"
interval = "PT1M"
}
}
}
}
}
}
{
"endpoints": {
"prometheus": {
"sensitive": false
}
},
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"prometheus": {
"enabled": true,
"step": "PT1M",
"descriptions": true,
"pushgateway": {
"enabled": true,
"address": "localhost:9091",
"interval": "PT1M"
}
}
}
}
}
}
6.20 SignalFx Registry
You can include the SignalFx reporter via io.micronaut.micrometer:micronaut-micrometer-registry-signalfx
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-signalfx")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-signalfx</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.signalfx
. The most commonly changed configuration properties are listed below, but see SignalFxConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
accessToken |
SignalFX access token. Required. |
step |
How frequently to report metrics. Default: |
descriptions |
Whether meter descriptions should be sent to InfluxDB. Disable to minimize the amount of data sent on each scrape. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.signalfx.enabled=true
micronaut.metrics.export.signalfx.accessToken=${SIGNALFX_API_TOKEN}
micronaut.metrics.export.signalfx.step=PT1M
micronaut:
metrics:
enabled: true
export:
signalfx:
enabled: true
accessToken: ${SIGNALFX_API_TOKEN}
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.signalfx]
enabled=true
accessToken="${SIGNALFX_API_TOKEN}"
step="PT1M"
micronaut {
metrics {
enabled = true
export {
signalfx {
enabled = true
accessToken = "${SIGNALFX_API_TOKEN}"
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
signalfx {
enabled = true
accessToken = "${SIGNALFX_API_TOKEN}"
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"signalfx": {
"enabled": true,
"accessToken": "${SIGNALFX_API_TOKEN}",
"step": "PT1M"
}
}
}
}
}
6.21 Stackdriver Registry
You can include the Stackdriver reporter via io.micronaut.micrometer:micronaut-micrometer-registry-stackdriver
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-stackdriver")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-stackdriver</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.stackdriver
. The most commonly changed configuration properties are listed below, but see StackdriverConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
projectId |
Stackdriver Project ID. Required. |
step |
How frequently to report metrics. Default: |
descriptions |
Whether meter descriptions should be sent to InfluxDB. Disable to minimize the amount of data sent on each scrape. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.stackdriver.enabled=true
micronaut.metrics.export.stackdriver.projectId=${STACKDRIVER_PROJECT_ID}
micronaut.metrics.export.stackdriver.step=PT1M
micronaut:
metrics:
enabled: true
export:
stackdriver:
enabled: true
projectId: ${STACKDRIVER_PROJECT_ID}
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.stackdriver]
enabled=true
projectId="${STACKDRIVER_PROJECT_ID}"
step="PT1M"
micronaut {
metrics {
enabled = true
export {
stackdriver {
enabled = true
projectId = "${STACKDRIVER_PROJECT_ID}"
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
stackdriver {
enabled = true
projectId = "${STACKDRIVER_PROJECT_ID}"
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"stackdriver": {
"enabled": true,
"projectId": "${STACKDRIVER_PROJECT_ID}",
"step": "PT1M"
}
}
}
}
}
6.22 StatsD Registry
You can include the StatsD reporter via io.micronaut.micrometer:micronaut-micrometer-registry-statsd
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-statsd")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-statsd</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.statsd
. The most commonly changed configuration properties are listed below, but see StatsdConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
flavor |
The type of metric to use ( |
step |
How frequently to report metrics. Default: |
host |
The StatsD server. Default: |
port |
The StatsD port. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.statsd.enabled=true
micronaut.metrics.export.statsd.flavor=datadog
micronaut.metrics.export.statsd.step=PT1M
micronaut.metrics.export.statsd.host=localhost
micronaut.metrics.export.statsd.port=8125
micronaut:
metrics:
enabled: true
export:
statsd:
enabled: true
flavor: datadog
step: PT1M
host: localhost
port: 8125
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.statsd]
enabled=true
flavor="datadog"
step="PT1M"
host="localhost"
port=8125
micronaut {
metrics {
enabled = true
export {
statsd {
enabled = true
flavor = "datadog"
step = "PT1M"
host = "localhost"
port = 8125
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
statsd {
enabled = true
flavor = "datadog"
step = "PT1M"
host = "localhost"
port = 8125
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"statsd": {
"enabled": true,
"flavor": "datadog",
"step": "PT1M",
"host": "localhost",
"port": 8125
}
}
}
}
}
6.23 Wavefront Registry
You can include the Wavefront reporter via io.micronaut.micrometer:micronaut-micrometer-registry-wavefront
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-wavefront")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-registry-wavefront</artifactId>
</dependency>
You can configure this reporter using micronaut.metrics.export.wavefront
. The most commonly changed configuration properties are listed below, but see WavefrontConfig for more options.
Name |
Description |
enabled |
Whether to enable the reporter, for example per-environment or for local development. Default: |
apiToken |
Wavefront API token. Required. |
uri |
Wavefront service URI. Required. |
step |
How frequently to report metrics. Default: |
descriptions |
Whether meter descriptions should be sent to InfluxDB. Disable to minimize the amount of data sent on each scrape. Default: |
micronaut.metrics.enabled=true
micronaut.metrics.export.wavefront.enabled=true
micronaut.metrics.export.wavefront.apiToken=${WAVEFRONT_API_TOKEN}
micronaut.metrics.export.wavefront.uri=https://longboard.wavefront.com
micronaut.metrics.export.wavefront.step=PT1M
micronaut:
metrics:
enabled: true
export:
wavefront:
enabled: true
apiToken: ${WAVEFRONT_API_TOKEN}
uri: https://longboard.wavefront.com
step: PT1M
[micronaut]
[micronaut.metrics]
enabled=true
[micronaut.metrics.export]
[micronaut.metrics.export.wavefront]
enabled=true
apiToken="${WAVEFRONT_API_TOKEN}"
uri="https://longboard.wavefront.com"
step="PT1M"
micronaut {
metrics {
enabled = true
export {
wavefront {
enabled = true
apiToken = "${WAVEFRONT_API_TOKEN}"
uri = "https://longboard.wavefront.com"
step = "PT1M"
}
}
}
}
{
micronaut {
metrics {
enabled = true
export {
wavefront {
enabled = true
apiToken = "${WAVEFRONT_API_TOKEN}"
uri = "https://longboard.wavefront.com"
step = "PT1M"
}
}
}
}
}
{
"micronaut": {
"metrics": {
"enabled": true,
"export": {
"wavefront": {
"enabled": true,
"apiToken": "${WAVEFRONT_API_TOKEN}",
"uri": "https://longboard.wavefront.com",
"step": "PT1M"
}
}
}
}
}
7 Observation
Micrometer Observation
The Micronaut Micrometer Observation module simplifies the process of instrumenting your code for gathering traces and metrics. To get started, add the following dependency to your project:
implementation("io.micronaut.micrometer:micronaut-micrometer-observation")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-observation</artifactId>
</dependency>
This module enables you to leverage the @Observed
annotation in your code, making it easier to monitor your application. Additionally, it allows you to create custom Observations.
When your application registers a singleton instance of the MeterRegistry
class, the Observation API will export metrics. Similarly, registering a singleton instance of the Trace
class will enable the export of traces.
To effortlessly establish a singleton instance of MeterRegistry, you can include the following dependency, which takes care of the registration process for you:
implementation("io.micronaut.micrometer:micronaut-micrometer-core")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-core</artifactId>
</dependency>
It’s worth noting that at present, the creation of a singleton instance for Trace requires manual configuration and is not automated by default.
You can also specify key-value pairs inside the micrometer.observations.common-key-value
configuration, which will be added as low-cardinality key-values to all your observations.
Micrometer Observation HTTP
The Micronaut Observation HTTP module offers automatic instrumentation for both the Micronaut HTTP server and Micronaut HTTP clients, making it easy to monitor HTTP-related metrics and traces. . With this module, every request received by the server and every request sent from the server triggers the creation of an observation with the necessary low and high cardinality values. Depending on your application’s configuration, these values can be displayed as metrics (if you have registered the MeterRegistry
singleton bean) and as trace spans (if you have registered the Trace
singleton bean).
To include this module in your project, add the following dependency:
implementation("io.micronaut.micrometer:micronaut-micrometer-observation-http")
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-observation-http</artifactId>
</dependency>
You can configure the behavior of this module by modifying the following properties:
-
To disable HTTP server instrumentation, set the
micrometer.observation.http.server.enabled
property tofalse
(the default value istrue
). -
To disable HTTP client instrumentation, set the
micrometer.observation.http.client.enabled
property tofalse
(the default value istrue
).
8 Guides
See the following list of guides to learn more about working with Metrics in the Micronaut Framework:
9 Repository
You can find the source code of this project in this repository: