public interface GatewayMeterRegistry
MeterRegistry
instance and to provide useful
utility methods to create tags which can be used by application and
framework.Modifier and Type | Field and Description |
---|---|
static String |
TAG_KEY_EXCEPTION
Key for 'exception' tag.
|
static String |
TAG_KEY_REASON
Key for 'reason' tag.
|
static String |
TAG_KEY_SERVICE
Key for 'service' tag.
|
static String |
TAG_VALUE_PLACEHOLDER
Placeholder value for any tag.
|
Modifier and Type | Method and Description |
---|---|
static List<io.micrometer.core.instrument.Tag> |
appendTags(List<io.micrometer.core.instrument.Tag> tags,
String key,
String value)
Creates aggregated list of tags with passed key and value for a tag.
|
static List<io.micrometer.core.instrument.Tag> |
createTagsWithException(List<io.micrometer.core.instrument.Tag> tags,
Throwable exception)
Creates aggregated list of tags with passed list and tag with exception
detail.
|
io.micrometer.core.instrument.MeterRegistry |
getMeterRegistry()
Should return
MeterRegistry instance for the application. |
static List<io.micrometer.core.instrument.Tag> |
getServiceNameTag(String serviceName)
Creates a singleton list with
Tag containing name of the service
for which the metrics is being collected. |
static final String TAG_KEY_SERVICE
Tag with this name should be used for all service specific Meter
s. This is used to mark metrics for specific service.
getServiceNameTag(String)
,
Constant Field Valuesstatic final String TAG_KEY_REASON
This can be used for creating tag for any meters where having a reason makes sense.
static final String TAG_KEY_EXCEPTION
This can be used for creating tag for any meters related to expose exception related metrics.
static final String TAG_VALUE_PLACEHOLDER
This can be used as placeholder value for any tag, for which value is not known beforehand and is updated when an event occurs.
io.micrometer.core.instrument.MeterRegistry getMeterRegistry()
MeterRegistry
instance for the application. This
can be any implementation of MeterRegistry
for specific backend
monitoring tool or a composite registry for multiple monitoring tools.
More details about MeterRegistry
can be found in official
documentation of
Micrometer
Following the documentation of micrometer, to use MeterRegistry
for specific monitoring tool, corresponding dependency should be added
for application. For example: To expose application metrics in prometheus
following dependency should be added to maven's POM file of application.
<dependency> <groupId>io.micrometer</groupId> <artifactId>micrometer-registry-prometheus</artifactId> <version>1.9.2</version> </dependency>The returned
MeterRegistry
instance will be further configured by
the framework. If metrics is disabled in configuration, all registered
Meter
s will be denied. Any meter names configured to be filtered
in configuration will be filtered out in MeterRegistry configuration.MeterRegistry
for application specific
monitoring tool.static List<io.micrometer.core.instrument.Tag> createTagsWithException(List<io.micrometer.core.instrument.Tag> tags, Throwable exception)
tags
- List of prebuilt tags to include.exception
- Exception to fetch value for 'exception' tag.static List<io.micrometer.core.instrument.Tag> appendTags(List<io.micrometer.core.instrument.Tag> tags, String key, String value)
tags
- List of prebuilt tags to include.key
- Key name for tag.value
- Value for tag.static List<io.micrometer.core.instrument.Tag> getServiceNameTag(String serviceName)
Tag
containing name of the service
for which the metrics is being collected.
This method can be used to create a Tag
with key 'service' and
passed 'serviceName' as value, which can be used with Meter
for
services.
serviceName
- to be used as value in tag.Tag
for specifying name of the
service for which the metrics is being collected.Copyright © 2024 DiffusionData Limited. All rights reserved.