Exporter contract (v0.1.0)
type Exporter interface {
Name() string
Export(ctx context.Context, samples []Sample) error
Close() error
}
Metrics core
- Counter and Gauge snapshot as scalar values.
- Histogram snapshot exports `_bucket`, `_count`, and `_sum` series.
- Timer records durations in seconds on top of histogram buckets.
- Metric identity remains name + labels sorted by key.
Retry and backoff
- Configurable in code via Config.
- Default max retries: 5
- Default initial backoff: 500ms
- Default backoff cap: 30s
- Default jitter factor: 0.20
- Strategy: exponential backoff with jitter.
- Non-retryable failures can be marked with NonRetryable(err) and fail fast.
Hardware collection (Linux)
- Integrated in the agent sample loop.
- Includes CPU usage, memory usage, disk usage, load averages, and CPU temperature when the thermal interface is available.
- Can be disabled with Config.DisableHardware.
- Non-Linux platforms use a no-op collector for development compatibility.
WAL (persistence)
- Default mode: batched fsync (1s or 100 records).
- Optional strict mode: fsync per write.
- Format: length prefix + payload + crc32.
- Replay in order; partial tail is truncated to the last valid record.
- Rotation: 64 MiB segments, 512 MiB total cap.
- Successful exports acknowledge WAL segments and compact acknowledged files.
Out of scope for v0.1.0
- Full cross-platform temperature support.
- Full Windows PDH implementation.
- Additional advanced exporters.