Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nick/split cost usage window #145

Merged
merged 1 commit into from
Mar 15, 2023
Merged

Conversation

nickcurie
Copy link
Contributor

@nickcurie nickcurie commented Mar 8, 2023

What does this PR change?

  • Splits window flag into two separate flags. One for determining historical usage, and another for determining costs.
    • This allows users to use reconciled cost data by passing a 48hr offset window.

Does this PR rely on any other PRs?

How does this PR impact users? (This is the kind of thing that goes in release notes!)

  • Added separate usage and cost window flags

Links to Issues or ZD tickets this PR addresses or fixes

How was this PR tested?

Observed flags sending correct windows for both usage and cost

Have you made an update to documentation?

No

Comment on lines 69 to 70
cmd.Flags().StringVar(&predictO.avgUsageWindow, "avgUsageWindow", "2d", "The window of cost data to base average usage on. See https://github.com/kubecost/docs/blob/master/allocation.md#querying for a detailed explanation of what can be passed here.")
cmd.Flags().StringVar(&predictO.resourceCostWindow, "resourceCostWindow", "7d offset 48h", "The window of cost data to base resource costs on. See https://github.com/kubecost/docs/blob/master/allocation.md#querying for a detailed explanation of what can be passed here.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shell convention is to use - separators instead of camel case and to prioritize brevity (in flag names).

Suggested change
cmd.Flags().StringVar(&predictO.avgUsageWindow, "avgUsageWindow", "2d", "The window of cost data to base average usage on. See https://github.com/kubecost/docs/blob/master/allocation.md#querying for a detailed explanation of what can be passed here.")
cmd.Flags().StringVar(&predictO.resourceCostWindow, "resourceCostWindow", "7d offset 48h", "The window of cost data to base resource costs on. See https://github.com/kubecost/docs/blob/master/allocation.md#querying for a detailed explanation of what can be passed here.")
cmd.Flags().StringVar(&predictO.avgUsageWindow, "window-usage", "2d", "The window of Kubecost data to calculate historical average usage from, if historical data exists. See https://github.com/kubecost/docs/blob/master/allocation.md#querying for a detailed explanation of what can be passed here.")
cmd.Flags().StringVar(&predictO.resourceCostWindow, "window-cost", "7d offset 48h", "The window of Kubecost data to base resource costs on. Defaults with an offset of 48h to incorporate reconciled data if reconciliation is set up. See https://github.com/kubecost/docs/blob/master/allocation.md#querying for a detailed explanation of what can be passed here.")

@nickcurie nickcurie force-pushed the nick/split-cost-usage-window branch from bdac150 to e6065b3 Compare March 9, 2023 19:28
Copy link
Contributor

@michaelmdresser michaelmdresser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thank you

@michaelmdresser
Copy link
Contributor

NOTE: This cannot be released until v1.102 of Kubecost. Perhaps we should make a compatibility note in the README as part of this PR. I'll give it some thought.

@nickcurie nickcurie marked this pull request as ready for review March 15, 2023 23:41
@nickcurie nickcurie merged commit a870d37 into main Mar 15, 2023
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.

None yet

2 participants