Deployment metrics not being recorded #1
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug: Deployment metrics not being recorded
Summary
The
homelab_deploy_deployment_duration_secondshistogram andhomelab_deploy_deployments_totalcounter metrics are never populated with deployment data. All values remain at 0 even after successful deployments.Environment
Steps to Reproduce
deploy(all=true, action="switch")Expected Behavior
After a successful deployment:
deployments_total{status="completed"}should increment by 1deployment_duration_seconds_count{success="true"}should increment by 1deployment_duration_seconds_sum{success="true"}should contain the deployment durationActual Behavior
All metric values are 0:
deployments_total: 0deployment_duration_seconds_count: 0deployment_duration_seconds_sum: 0The metric labels (action, success, hostname, tier, etc.) are present, indicating the metrics are registered correctly. However, no observations are being recorded.
Working Functionality
The following features work correctly:
homelab_deploy_infometric is populated correctly with version 0.1.12Root Cause Hypothesis
The histogram
.Observe()and counter.Inc()methods are not being called after deployment completion. The scrape-wait logic is functioning, but there's nothing to scrape because the metrics were never updated.Additional Context
Verified using
max_over_time(...[10m])that Prometheus never captured non-zero values, confirming the metrics are never populated rather than being reset before scrape.Testing Debug Logging for Metrics
Update your flake input to use the branch:
Then enable debug logging in your NixOS config:
After rebuilding and running a deployment, check the logs:
You should see entries like:
If you see
"metrics_enabled":falseor no debug messages at all, that will help pinpoint the issue.