Record batch machine command timings#1236
Open
karenychen wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the AKS Machine scale-out path to capture per-batch BatchPutMachine timing metrics and emit them as operation metadata, with accompanying test updates to validate metric capture and metadata emission.
Changes:
- Record per-batch start/end timestamps and execution duration in
_create_batch_machines. - Emit
batch_command_execution_timesasscale_machineoperation metadata whenuse_batch_api=True. - Update machine-client tests to cover timing metric capture and metadata emission.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| modules/python/clients/aks_machine_client.py | Captures per-batch timing metrics and emits them as scale_machine operation metadata. |
| modules/python/tests/test_aks_machine_client.py | Extends tests to assert timing metrics are captured and metadata is emitted for the batch path. |
Comments suppressed due to low confidence (1)
modules/python/clients/aks_machine_client.py:921
execution_time_secondsis derived fromdatetime.now()deltas, which can go negative or be skewed if the system clock adjusts (e.g., NTP). For durations, use a monotonic timer (time.perf_counter()/time.monotonic()) and keepdatetimeonly for the wall-clock timestamps.
start_time = datetime.now(timezone.utc)
self._make_batch_request(
"PUT",
url,
body,
Comment on lines
+935
to
+940
| metric = { | ||
| "start_time": start_time.isoformat().replace("+00:00", "Z"), | ||
| "end_time": end_time.isoformat().replace("+00:00", "Z"), | ||
| "execution_time_seconds": execution_time_seconds, | ||
| "total_machines_in_batch": len(chunk), | ||
| } |
Contributor
Author
Code reviewNo issues found. Checked for bugs and AGENTS.md compliance. |
Contributor
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
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.
Summary
Tests