Observability
Use --write-metrics to export a metrics snapshot alongside the normal scan results. Collecting a snapshot on each CI scan lets you continuously monitor unused code in large codebases and see how it changes over time.
periphery scan --write-metrics scan.promThe default is Prometheus text format 1.0.0. For OpenMetrics text format 1.0.0, add --metrics-format openmetrics. Both work with every results format and can be configured using write_metrics and metrics_format in .periphery.yml.
| Metric | Meaning |
|---|---|
periphery_scan_source_lines |
Scanned LOC, excluding comments and blank lines. |
periphery_scan_results |
Number of reported results. |
periphery_scan_removable_lines |
Removable LOC, counting overlapping ranges once and excluding partial line edits. |
periphery_scan_unused_ratio |
Removable LOC divided by scanned LOC: 0.075 means 7.5%. Zero when scanned LOC is zero. |
periphery_scan_baseline_entries |
Unique identifiers in the input baseline, emitted only when --baseline is used. Includes stale entries; it is not the count of findings suppressed. |
All metrics are gauges. Findings and removable LOC reflect baseline and report filtering; scanned LOC covers the entire scan.