Expand description
Metrics collection and daily-rotating JSONL emission.
Provides a channel-based pipeline: callers emit MetricEvent values via MetricsSender,
and MetricsWriter drains the channel and appends events to a daily-rotated JSONL file
under the XDG data directory (~/.local/share/code-analyze-mcp/metrics-YYYY-MM-DD.jsonl).
Files older than 30 days are deleted on startup.
Structs§
- Metric
Event - A single metric event emitted by a tool invocation.
- Metrics
Sender - Sender half of the metrics channel; cloned and passed to tools for event emission.
- Metrics
Writer - Receiver half of the metrics channel; drains events and writes them to daily-rotated JSONL files.
Functions§
- current_
date_ str - Returns the current UTC date as a string in YYYY-MM-DD format.
- error_
code_ to_ type - Maps an MCP error code to a short string representation for metrics.
- path_
component_ count - Counts the number of path segments in a file path.
- unix_ms
- Returns the current UNIX timestamp in milliseconds.