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:
4
main.go
4
main.go
@@ -15,6 +15,8 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
)
|
||||
|
||||
const version = "0.2.0"
|
||||
|
||||
func main() {
|
||||
cfg, err := config.Parse()
|
||||
if err != nil {
|
||||
@@ -59,7 +61,7 @@ func main() {
|
||||
defer stop()
|
||||
|
||||
go func() {
|
||||
slog.Info("Starting server", "addr", cfg.ListenAddr)
|
||||
slog.Info("Starting server", "version", version, "addr", cfg.ListenAddr)
|
||||
if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
||||
slog.Error("Server error", "error", err)
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user