monochange_telemetry
monochange_telemetry provides local-only telemetry primitives for the monochange CLI.
Reach for this crate when you need the reusable event sink, event payloads, and privacy-preserving error classification that power opt-in local JSONL telemetry. The crate intentionally keeps transport simple: it appends OpenTelemetry-style JSON Lines records to a local file and does not send telemetry over the network.
Why use it?
- keep telemetry capture separate from CLI orchestration and package discovery
- share one local JSONL event schema across command and step instrumentation
- classify errors into low-cardinality categories without exposing raw error text
- make telemetry writes best-effort so observability cannot change command outcomes
Best for
- embedding monochange's local telemetry sink in the CLI runtime
- smoke-testing event schemas without provisioning a backend
- building future telemetry commands, exporters, or redaction tests on top of a small public API
Public entry points
TelemetrySink::from_env()resolvesMC_TELEMETRYandMC_TELEMETRY_FILEinto either a disabled sink or a local JSONL sinkTelemetrySink::capture_command(...)writescommand_runeventsTelemetrySink::capture_step(...)writescommand_stepeventsCommandTelemetry,StepTelemetry, andTelemetryOutcomedescribe the stable event payloads
Privacy boundaries
The crate only accepts low-cardinality command metadata, booleans, counts, durations, enum outcomes, and sanitized error_kind values. It does not collect package names, paths, repository URLs, branch names, refs, commit hashes, shell command strings, environment values, changeset text, release notes, issue or pull request IDs, or raw errors.
Example
use CommandTelemetry;
use TelemetryOutcome;
use TelemetrySink;
use Duration;
let sink = Disabled;
sink.capture_command;