# `Slap.Streams.Metrics`
[🔗](https://github.com/mjrusso/slap/blob/slap_streams-v0.4.0/slap_streams/lib/slap/streams/metrics.ex#L1)

Prometheus metrics from `Slap.Streams.Telemetry`'s events and `slap_cluster`'s,
kept in ETS and rendered in the text exposition format by `render/0`
(served by `Slap.Streams.HTTP.Metrics`).

One metrics process runs per VM. Its labels do not distinguish separate
Streams clusters on that VM. It ignores cluster events from other services,
such as `Slap.KV.Cluster`.

| Metric | Type | Labels |
|---|---|---|
| `slap_streams_append_duration_seconds` | histogram | accept to durable reply |
| `slap_streams_appends_total` | counter | `result` |
| `slap_streams_append_bytes_total` | counter | |
| `slap_streams_appends_rejected_total` | counter | `reason` (backpressure) |
| `slap_streams_write_failures_total` | counter | |
| `slap_streams_stream_servers` | gauge | `shard` |
| `slap_streams_inflight_bytes`, `slap_streams_inflight_requests` | gauge | `shard` |
| `slap_streams_waiters` | gauge | `shard` (long-poll and SSE) |
| `slap_streams_delete_backlog`, `slap_streams_expiry_due` | gauge | `shard` (job backlogs) |
| `slap_streams_l0_ssts`, `slap_streams_sorted_runs` | gauge | `shard` (compaction backlog) |
| `slap_streams_block_cache_hits_total`, `slap_streams_block_cache_misses_total` | counter | `shard` |
| `slap_streams_durability_lag` | gauge | `shard` (seqs written, not durable) |
| `slap_streams_shard_events_total` | counter | `event` (`start`, `stop`, `fenced`) |
| `slap_streams_store_probe_ok` | gauge | 1 if the most recent store probe passed |
| `slap_streams_http_requests_total` | counter | `method`, `status` |
| `slap_streams_http_request_duration_seconds` | histogram | `method` |

This is a small exporter of its own rather than `telemetry_metrics` and
its Prometheus reporter: the metrics are fixed, and it keeps the
dependencies to `telemetry`.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `render`

```elixir
@spec render() :: iodata()
```

The metrics in the Prometheus text format.

# `start_link`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
