feat: add nodepool_provisioning_duration metric#40
Open
Asrarfarooq wants to merge 2 commits into
Open
Conversation
Updated internal/records/events_test.go to expect ProvisioningDuration: 1h and ProvisioningState: "success" for older test cases that calculate these values but previously defaulted to zero values in the test table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title
feat: add nodepool_provisioning_duration metricDescription
This PR introduces a new metric,
nodepool_provisioning_duration, to track and report the time taken for GKE NodePools to become ready after creation. This helps in monitoring provisioning latency and identifying slow scaling events.Results
We verified the new metric on a live cluster (
megamon-test-cluster) by creating test TPU node pools and observing the output.Raw Metrics Output
Curling the metrics endpoint (
:8080/metrics) confirmed that the metric is emitted correctly with the expected labels and values:Controller Logs
The logs confirm the internal calculation of
provisioningDuration(in nanoseconds) matching the external metrics:{ "type": "nodepools", "summary": { "downTimeProvisioned": 190008424911, "provisioningDuration": 190008424911, "provisioningState": "success" } }These results confirm that:
Key Changes
internal/records/events.go: Added logic to calculateProvisioningDurationand determineProvisioningState("provisioning", "success", or "failed").internal/metrics/metrics.go: Registered and implemented the emission of the newnodepool_provisioning_durationmetric.internal/records/events_test.go: Added test cases inTestSummarizeto verify correct calculation of provisioning duration and state.test/integration/cases_test.go: Updated integration tests to verify metric emission in simulated scenarios.Context
This branch has been rebased on top of the latest
main(which includes the consolidated workload reconciler changes from PR #39) to ensure a clean and isolated diff containing only this feature. Conflict inevents_test.gowas resolved by combining assertions from both branches.