Skip to content

Add oldest instance age metric by state#165

Merged
sjmiller609 merged 1 commit into
mainfrom
codex/add-oldest-instance-state-metric
Mar 25, 2026
Merged

Add oldest instance age metric by state#165
sjmiller609 merged 1 commit into
mainfrom
codex/add-oldest-instance-state-metric

Conversation

@sjmiller609

@sjmiller609 sjmiller609 commented Mar 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add hypeman_instances_oldest_in_state_seconds as an observable gauge grouped by state and hypervisor
  • compute the oldest current instance age per state alongside the existing hypeman_instances_total callback
  • add a focused unit test covering stopped and standby instances with different ages

Testing

  • go test ./lib/instances -run 'TestSnapshotCompressionMetrics_RecordAndObserve|TestInstanceOldestInStateMetric_ObserveOldestAgePerState'

Note

Low Risk
Low risk: adds a read-only OpenTelemetry gauge and a unit test; behavior change is limited to metrics emission and clamps invalid/negative ages to 0.

Overview
Adds a new observable gauge, hypeman_instances_oldest_in_state_seconds, labeled by state and hypervisor, computed in the same callback as hypeman_instances_total by tracking the maximum age since CreatedAt (with zero/negative ages ignored or clamped).

Extends metrics_test.go with a focused test that creates multiple instances across stopped/standby states and verifies both the per-state counts and the reported oldest age values.

Written by Cursor Bugbot for commit eb2bf25. This will update automatically on new commits. Configure here.

@sjmiller609 sjmiller609 marked this pull request as ready for review March 25, 2026 14:47
@sjmiller609 sjmiller609 merged commit 5a92174 into main Mar 25, 2026
8 of 9 checks passed
@sjmiller609 sjmiller609 deleted the codex/add-oldest-instance-state-metric branch March 25, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant