Metrics
Module for collecting application metrics using Micrometer.
Requires private HTTP server module added to provide metrics in prometheus format.
Dependency¶
Dependency build.gradle:
Module:
Dependency build.gradle.kts:
Module:
Configuration¶
Example of HTTP server path configuration for retrieving metrics described in the HttpServerConfig class (default values are specified):
- Path to get metrics in
prometheusformat (if HTTP server module is added):
- Path to get metrics in
prometheusformat (if HTTP server module is added):
Example of the complete configuration described in the MetricsConfig class (default values are specified):
Metrics collection configuration parameters are described in modules where metrics collection is present, e.g. HTTP server, HTTP client, etc.
Usage¶
We follow and encourage to use the notation described in the specification.
Once the Metrics.globalRegistry module is connected, the PrometheusMeterRegistry will be registered and used in all components that collect metrics.
Personalization¶
In order to make changes to the PrometheusMeterRegistry configuration, you need to add to the PrometheusMeterRegistryInitializer container.
Important, PrometheusMeterRegistryInitializer is applied only once when the application is initialized.
For example, we want to add a common tag for all metrics:
Standard metrics have some configurations such as ServiceLayerObjectives for Distribution summary metrics.
The configuration field names can be viewed in ru.tinkoff.kora.micrometer.module.MetricsConfig.
Standard¶
The original metrics format used the OpenTelemetry V120 standard, after Kora 1.1.0 it became possible to provide metrics in the OpenTelemetry V123 standard.
in the OpenTelemetry V123 standard, a partial list of changes can be seen in the OpenTelemetry documentation
and OpenTelemetry migration guidelines