Improve --latest option (legacy)#49
Open
pjcdawkins wants to merge 2 commits intomainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the legacy metrics commands’ --latest behavior to use a 5-minute “grain” by default (and a 5-minute range when no explicit range/interval is provided), aligning the CLI output with the metrics API’s aggregation window expectations.
Changes:
- Added
LATEST_GRAIN(300s) and documentedDEFAULT_RANGEas 10 minutes. - Updated
--latestoption help text to mention the 5-minute aggregation window and how to override it. - Adjusted time validation so
--latestdefaults to a 5-minute range and grain when--intervalis not provided.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Detect whether `--interval` was provided using a strict null/empty-string check rather than truthiness, so a literal `0` (or any duration that parses to zero seconds) is rejected with a clear error instead of being silently replaced with the default range/grain. Also corrects a stale "Invalid --range" message in the --interval validation branch. Addresses Copilot review feedback on #49. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Migrated from platformsh/legacy-cli#1596 (original author: @mharacewiat).
Adds a
LATEST_GRAINconstant (300s) used as the default range and interval when--latestis given without an explicit--interval, and updates the option help to mention the 5-minute aggregation window. The 5.x DI/public conststyle was preserved when re-applying the patch.Closes #45