On this page
Metric Writer
§6.3.1 Ingestion thread
eventd MUST run a dedicated metric ingestion thread that reads datagrams from the metric socket and writes data points to the metric store. The metric ingestion thread is independent of the event and log ingestion paths.
§6.3.2 Processing
For each received metric record, the ingestion thread:
- Resolves the time series by name and labels using the in-memory series cache (§7.1). If the series does not exist, a new row is inserted into the
seriestable with the type from the record, and the cache is updated. - Validates that the record's type matches the series type. If the type does not match (e.g., a gauge sample for a series registered as a counter), the record MUST be dropped silently. The series type is set at creation time and is immutable -- a series cannot change type.
- Inserts a row into the
samplestable with the resolvedseries_id, timestamp, and value. For histogram-type metrics, the histogram data is encoded as msgpack and stored in thehistogram_datacolumn.
§6.3.3 Batched writes
The metric writer uses the same adaptive batch sizing approach as the event and log writers. Metric data points are accumulated into a transaction and committed when either the batch size or latency threshold is reached.
The metric writer's batch parameters are configured independently:
| Key | Type | Default | Valid range | Description |
|---|---|---|---|---|
| MetricMaxBatchSize | REG_DWORD | 5000 | 100--100000 | Maximum metric samples per transaction. |
| MetricMaxBatchLatencyMs | REG_DWORD | 1000 | 10--5000 | Maximum ms before a metric batch is committed. |
§6.3.4 SQLite configuration
The metric store database MUST be opened in WAL mode. The synchronous pragma SHOULD be set to NORMAL. Per-transaction fsync is not required for metrics because metric loss on power failure is acceptable.
§6.3.5 Series cache
The in-memory series cache maps (name, canonical labels, boundaries hash) to series_id. For counter and gauge series, the boundaries hash component is absent. The cache is bounded by MetricSeriesCacheSize (default 50,000 entries) and uses LRU eviction. Cache hits resolve series in a hash table lookup. Cache misses fall back to a SQLite SELECT and insert the result into the cache, evicting the least recently used entry if full. See §7.1 for details.