# Monitoring Krenalis monitors its own internal service metrics, and makes them available under the `/metrics` path. You can control whether this endpoint is available by using the `KRENALIS_PROMETHEUS_METRICS_ENABLED` environment variable. By default, this variable is set to `false`, so the `/metrics` endpoint is disabled unless you explicitly enable it. In Docker Compose installations, `KRENALIS_PROMETHEUS_METRICS_ENABLED` is set to `true` by default. This means the `/metrics` endpoint is automatically enabled in that setup. ## Metrics | Name | Type | Labels | Description | |----------------------------------------------|--------------|------------------------------|--------------------------------------------------------------------------| | `krenalis_db_acquired_conns` | Gauge | – | Current number of connections in use by the database connection pool. | | `krenalis_db_max_conns` | Gauge | – | Configured maximum number of simultaneous database connections. | | `krenalis_db_acquire_duration_seconds_total` | Counter | – | Cumulative seconds spent acquiring connections from the database pool. | | `krenalis_db_acquire_count_total` | Counter | – | Total number of successful database connection acquisitions. | | `krenalis_db_new_conns_count_total` | Counter | – | Total number of newly created database connections (connection churn). | | `krenalis_lambda_errors_total` | CounterVec | `type` | Total number of Lambda errors, categorized by error type. | | `krenalis_lambda_duration_seconds` | Histogram | – | Duration of successful Lambda executions, in seconds. | | `krenalis_lambda_records_total` | Counter | – | Total number of input records processed by successful Lambda executions. | | `krenalis_sender_queue_available` | GaugeVec | – | Number of available events in the event queue. | | `krenalis_sender_queue_wait` | HistogramVec | `connector`,
`connection` | Time spent waiting in the event queue (in seconds). | ### Notes - The total number of successful Lambda executions is provided by the metric `krenalis_lambda_duration_seconds_count`, which is part of the` krenalis_lambda_duration_seconds` histogram. It represents the total number of observations (i.e., completed executions) recorded in the histogram. - Possible values for the `type` label in `krenalis_lambda_errors_total`: `network`, `lambda_internal`, `function_not_found`, `serialization`, and `function_exec`. - Buckets defined for `krenalis_lambda_duration_seconds`: `0.1`, `0.5`, `1`, `2.5`, and `5` (in seconds) - Buckets defined for `krenalis_sender_queue_wait`: `0.005`, `0.01`, `0.025`, `0.05`, `0.075`, `0.1`, `0.15`, `0.2`, `0.3`, `0.5`, `0.75`, `1.0`, `2.0` (in seconds) ## Prometheus To monitor these metrics with [Prometheus](https://prometheus.io/), configure it with the following scrape job: ```yaml scrape_configs: - job_name: 'krenalis' static_configs: - targets: [ "127.0.0.1:2022" ] ``` ## Grafana After setting up Prometheus to collect the metrics, configure [Grafana](https://grafana.com/oss/grafana/) to display them in dashboards.