Skip to main content

Micrometer Observability

Gestalt exposes several observations and provides a implementation for micrometer.

To import the micrometer implementation add gestalt-micrometer to your build files.

In Maven:

<dependency>
<groupId>com.github.gestalt-config</groupId>
<artifactId>gestalt-micrometer</artifactId>
<version>${version}</version>
</dependency>

Or in Gradle

implementation("com.github.gestalt-config:gestalt-micrometer:${version}")

Then when building gestalt, you need to register the module config MicrometerModuleConfig using the MicrometerModuleConfigBuilder.

SimpleMeterRegistry registry = new SimpleMeterRegistry();

Gestalt gestalt = new GestaltBuilder()
.addSource(MapConfigSourceBuilder.builder().setCustomConfig(configs).build())
.setObservationsEnabled(true)
.addModuleConfig(MicrometerModuleConfigBuilder.builder()
.setMeterRegistry(registry)
.setPrefix("myApp")
.build())
.build();

gestalt.loadConfigs();

There are several options to configure the micrometer module.

OptionDescriptionDefault
meterRegistryProvide the micrometer registry to submit observations.SimpleMeterRegistry
includePathWhen getting a config include the path in the observations tags. This can be a high cardinality observation so is not recommended.false
includeClassWhen getting a config include the class in the observations tags. This can be a high cardinality observation so is not recommended.false
includeOptionalWhen getting a config include if the configuration is optional or default as a true or false in the observation tags.false
includeTagsWhen getting a config include the tags in the request in the observations tags.false
prefixAdd a prefix to the observations to better group your observations.gestalt

The following observations are exposed

ObservationsDescriptionTypetags
config.getRecorded when we request a configuration from gestalt that is not cached.Timerdefault:true if a default or optional value is returned. exception:exception class if there was an exception.
reloadRecorded when a configuration is reloaded.Timersource:source name. exception:exception class if there was an exception.
get.config.missingIncremented for each missing configuration, if decoding a class this can be more than one.Counteroptional: true or false depending if the optional value is optional or has a default.
get.config.errorIncremented for each error while getting a configuration, if decoding a class this can be more than one.Counter
get.config.warningIncremented for warning error while getting a configuration, if decoding a class this can be more than one.Counter
cache.hitIncremented for each request served from the cache. A cache miss would be recorded in the observations config.getCounter