Skip to content

Metrics exporters

Kuvasz supports exporting metrics to allow you to integrate with your existing monitoring and alerting systems. This way you can use Kuvasz alongside your preferred observability stack, so you can introduce it to your infrastructure step by step.

Enabling the export

2.1.0 false boolean

micronaut.metrics.enabled: true
ENABLE_METRICS_EXPORT=true

The metrics export is disabled by default, to enable it, you need to change either your YAML configuration or your environment variables. Don't forget to restart the container in both cases!

Exported metrics

Currently the following metrics are exported, but all of them is disabled by default, you can enable them one by one, tailored to your needs.

Every metric has the following labels/tags, that you can use to filter/group them in your monitoring backend:

  • name: the name of the monitor
  • url: the URL that is monitored

Uptime status

2.1.0 false boolean

metrics-exports.uptime-status: true
ENABLE_UPTIME_STATUS_EXPORT=true

This metric is exported as a gauge and indicates the current uptime status of the monitored services.

Status Gauge value
UP 1
DOWN 0

Latest latency

2.1.0 false boolean

metrics-exports.latest-latency: true
ENABLE_LATEST_LATENCY_EXPORT=true

This metric is exported as a gauge and reports the latest recorded latency of the monitored endpoint, in milliseconds.

SSL status

2.1.0 false boolean

metrics-exports.ssl-status: true
ENABLE_SSL_STATUS_EXPORT=true

This metric is exported as a gauge and indicates the current status of the SSL certificate of the monitored endpoint (only if SSL checks are enabled).

Status Gauge value
VALID, WILL_EXPIRE 1
INVALID 0

SSL expiry

2.1.0 false boolean

metrics-exports.ssl-expiry: true
ENABLE_SSL_EXPIRY_EXPORT=true

This metric is exported as a gauge and reports the expiry date (as a Unix timestamp) of the SSL certificate of the monitored endpoint (only if SSL checks are enabled).

Prometheus

The Prometheus exporter is a built-in exporter that allows you to expose your metrics in a format that can be scraped by Prometheus. It supports the standard Prometheus text format, which is widely used for monitoring and alerting.

Settings

Enabling the exporter

2.1.0 false boolean

micronaut.metrics.export.prometheus.enabled: true
ENABLE_PROMETHEUS_EXPORT=true

Descriptions

2.1.0 true boolean

micronaut.metrics.export.prometheus.descriptions: true
ENABLE_PROMETHEUS_DESCRIPTIONS=true

Whether meter descriptions should be exposed to Prometheus. Disable to minimize the amount of data sent on each scrape.

Scraping the metrics

The metrics are scrapeable through the /api/v1/prometheus endpoint, and you'll need to use your API key by default to access it, just like on any other API endpoint. In case you have disabled the authentication, the endpoint will be available without authentication, of course.

Example output

kuvasz_monitor_uptime_status{name="nytimes.com",url="https://www.nytimes.com"} 1.0
kuvasz_monitor_latency_latest_milliseconds{name="nytimes.com",url="https://www.nytimes.com"} 29.0
kuvasz_monitor_ssl_status{name="nytimes.com",url="https://www.nytimes.com"} 1.0
kuvasz_monitor_ssl_expiry_seconds{name="nytimes.com",url="https://www.nytimes.com"} 1.758828296E9

Example config

micronaut:
  metrics:
    enabled: true
    export:
      prometheus:
        enabled: true
        descriptions: true
---
metrics-exports:
    uptime-status: true
    latest-latency: true
    ssl-status: true
    ssl-expiry: true
ENABLE_METRICS_EXPORT=true
ENABLE_PROMETHEUS_EXPORT=true
ENABLE_PROMETHEUS_DESCRIPTIONS=true
# Enable the individual metrics
ENABLE_UPTIME_STATUS_EXPORT=true
ENABLE_LATEST_LATENCY_EXPORT=true
ENABLE_SSL_STATUS_EXPORT=true
ENABLE_SSL_EXPIRY_EXPORT=true

OpenTelemetry

The OpenTelemetry exporter is a built-in exporter that allows you to export your metrics to any compatible tool, that supports the OpenTelemetry Protocol (OTLP). OpenTelemetry is a vendor-neutral standard for collecting and exporting telemetry data, and a lot of modern observability tools support it (e.g. Datadog, New Relic, etc.).

Info

Kuvasz will automatically report the metrics to the configured endpoint at the specified frequency.

Settings

Enabling the exporter

2.1.0 false boolean

micronaut.metrics.export.otlp.enabled: true
ENABLE_OTLP_EXPORT=true

URL

2.1.0

micronaut.metrics.export.otlp.url: https://example.host:4318/v1/metrics
OTLP_EXPORT_URL=https://example.host:4318/v1/metrics

The URL of the OpenTelemetry endpoint to which the metrics will be reported. It is mandatory to set this, if you've enabled the exporter.

Headers

2.1.0 string

micronaut.metrics.export.otlp.headers: 'Authorization=Bearer Your-collectors-API-token,key2=value'
OTLP_EXPORT_HEADERS='Authorization=Bearer Your-collectors-API-token,key2=value'

The headers to be sent with the metrics export request. This is useful for authentication or other custom headers required by your OpenTelemetry collector. Multiple headers can be specified as a comma-separated list, in the format of key1=value1,key2=value2.

Step

2.1.0 PT1M ISO-8601 duration

micronaut.metrics.export.otlp.step: PT1M
OTLP_EXPORT_STEP=PT1M

The frequency of exporting the metrics to OpenTelemetry. The default is 1 minute. More about ISO-8601 durations here.

Example output

kuvasz.monitor.ssl.status{name=weather.com,url=https://weather.com} 1
kuvasz.monitor.latency.latest.milliseconds{name=samsung.com,url=https://www.samsung.com} 183
kuvasz.monitor.uptime.status{name=google.com,url=https://www.google.com} 1
kuvasz.monitor.ssl.expiry.seconds{name=bbc.com,url=https://www.bbc.com} 1.785147977e+09

Example config

micronaut:
  metrics:
    enabled: true
    export:
      otlp:
        enabled: true
        url: https://example.host:4318/v1/metrics
        headers: 'Authorization=Bearer Your-collectors-API-token,key2=value'
        step: PT1M
---
metrics-exports:
  uptime-status: true
  latest-latency: true
  ssl-status: true
  ssl-expiry: true
ENABLE_METRICS_EXPORT=true
ENABLE_OTLP_EXPORT=true
OTLP_EXPORT_URL=https://example.host:4318/v1/metrics
OTLP_EXPORT_HEADERS='Authorization=Bearer Your-collectors-API-token,key2=value'
OTLP_EXPORT_STEP=PT1M
# Enable the individual metrics
ENABLE_UPTIME_STATUS_EXPORT=true
ENABLE_LATEST_LATENCY_EXPORT=true
ENABLE_SSL_STATUS_EXPORT=true
ENABLE_SSL_EXPIRY_EXPORT=true