fix(hive-metric): multi-thread runtime + counter default

This commit is contained in:
damocles 2026-07-05 01:10:40 +02:00 committed by mara
commit 61dfceb100
2 changed files with 18 additions and 18 deletions

View file

@ -136,13 +136,13 @@ Agents can push arbitrary labeled metrics to the same OTEL collector via the
### Usage
```text
hive-metric <name> <value> [--type gauge|counter] [--labels key=value...]
hive-metric <name> <value> [--type counter|gauge] [--labels key=value...]
```
- `<name>` — metric name (e.g. `tasks_completed`, `latency_ms`).
- `<value>` — numeric value (f64; integers and floats both accepted).
- `--type gauge|counter` — metric kind: `gauge` (instantaneous, default) or
`counter` (monotonically increasing cumulative sum).
- `--type counter|gauge` — metric kind: `counter` (cumulative sum, default) or
`gauge` (instantaneous point-in-time value).
- `--labels key=value` — extra per-data-point labels. May be repeated.
The resource labels (agent, hive, swarm, service.name) are inherited
automatically from `OTEL_RESOURCE_ATTRIBUTES` — do not re-specify them.
@ -150,14 +150,14 @@ hive-metric <name> <value> [--type gauge|counter] [--labels key=value...]
### Examples
```text
# Gauge: current queue depth
hive-metric queue_depth 17
# Counter: cumulative tasks finished (default type — no --type flag needed)
hive-metric tasks_completed 1 --labels phase=scan
# Counter: cumulative tasks finished, with a custom label
hive-metric tasks_completed 1 --type counter --labels phase=scan
# Gauge: current queue depth (absolute value — must use --type gauge)
hive-metric queue_depth 17 --type gauge
# Float gauge with multiple labels
hive-metric api_latency_ms 142.5 --labels model=sonnet --labels tier=api
# Float gauge with multiple labels (instantaneous measurement)
hive-metric api_latency_ms 142.5 --type gauge --labels model=sonnet --labels tier=api
```
### Error when OTEL is not configured