Conversation
achilles_processing_duration_seconds metric for tracking e2e object processing latency
89b7656 to
662eb6b
Compare
3081845 to
d52a38f
Compare
kdorosh
reviewed
May 13, 2025
Contributor
kdorosh
left a comment
There was a problem hiding this comment.
couple suggestions; very neat stuff! stoked to have this kind of visibility in the SDK
kdorosh
approved these changes
May 13, 2025
karanthukral
approved these changes
May 14, 2025
Contributor
karanthukral
left a comment
There was a problem hiding this comment.
great job on this! took me a bit to follow the approach but makes sense
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.
Motivation
Controller-runtime's has built in duration metrics but none of them track e2e object processing latency qualified by success or failure:
workqueue_queue_duration_seconds_bucket: events can be requeued and rate limited—duration spent waiting due to rate limits are not measuredworkqueue_work_duration_seconds_bucket: is not qualified with processing success or failureWe want a metric that closely approximates what matters to end users or consuming systems—the amount of time it takes for a spec change to be successfully processed.
Implementation
Instruments a new histogram metric
achilles_processing_duration_secondstracking the time from when the controller receives an update to an object's spec to when that change is processed.The processing time span for a given spec change is correlated using
metadata.generation. A single reconciliation can process multiple generations, which is handled in the instrumentation.Details
(name, namespace, generation)a single time. Once observed, the data entry is marked with a boolean indicating that it's failure has already been observed, allowing subsequent observations to skip this one.Appendix
A more accurate metric would mark start time at admission time. But achieving this would require that consuming controllers deploy a webhook and further more, that the webhook share memory with the main controller binary.
I think this requirement is too onerous for the added accuracy. This metric doesn't measure latency incurred by the Kubernetes control plane itself (i.e. the time taken from when Kubernetes receives the object update to when it reflects that update back to WATCHers).
This latency can't be affected by the controller anyways + we have separate metrics for understanding k8s control plane performance.
✅ Checks