Skip to content

Add observability metrics for lockfile refresh and validation operations #91

Description

@coderabbitai

Background

Raised during review of PR #75 (refresh stale Cargo lockfiles before publish preflight).

Problem

lading/commands/lockfile.py uses LOGGER calls to record decisions at key points, but provides no structured metrics (counters, histograms, timers) for:

  • Lockfile discovery count (number of tracked lockfiles found)
  • Lockfile refresh duration and error rate
  • Lockfile freshness validation latency and failure rate

Without these, operators cannot diagnose throughput problems, track error trends, or alert on regressions in lockfile handling.

Suggested resolution

  • Choose and integrate a lightweight Python metrics framework (e.g., prometheus_client or a project-standard library) at the lading/commands/lockfile.py boundary.
  • Emit a counter on each successful and failed refresh_lockfile invocation.
  • Emit a histogram or timer around refresh_lockfile and validate_lockfile_freshness call duration.
  • Emit a gauge or counter for the number of lockfiles discovered by discover_tracked_lockfiles.
  • Document the metric names and labels in docs/developers-guide.md.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions