feat: add nixos_flake_info metric with current and remote revisions
Add a new info metric that exposes the current system's flake revision and the latest remote revision as labels. This makes it easier to see exactly which revision is deployed vs available. Also adds version constant to Go code and extracts it in flake.nix, providing a single source of truth for the version. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -80,6 +80,7 @@ services.prometheus.exporters.nixos = {
|
||||
|--------|------|--------|-------------|
|
||||
| `nixos_flake_input_age_seconds` | Gauge | `input` | Age of flake input in seconds |
|
||||
| `nixos_flake_input_info` | Gauge | `input`, `rev`, `type` | Info gauge with revision and type labels |
|
||||
| `nixos_flake_info` | Gauge | `current_rev`, `remote_rev` | Info gauge with current and remote flake revisions |
|
||||
| `nixos_flake_revision_behind` | Gauge | | 1 if current system revision differs from remote latest |
|
||||
|
||||
## Example Prometheus Alerts
|
||||
@@ -129,7 +130,7 @@ groups:
|
||||
|
||||
## Known Limitations
|
||||
|
||||
- The `nixos_flake_revision_behind` metric relies on parsing the git hash from `/run/current-system/nixos-version`. The format of this file varies depending on NixOS configuration:
|
||||
- The `nixos_flake_info` and `nixos_flake_revision_behind` metrics rely on parsing the git hash from `/run/current-system/nixos-version`. The format of this file varies depending on NixOS configuration:
|
||||
- Standard format: `25.11.20260203.e576e3c`
|
||||
- Custom format: `1994-294a625`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user