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

Exposing summary_view lookback period in a parameter #958

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cfn-templates/cid-cfn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ Metadata:
default: "Deploy KPI Dashboard"
OptimizationDataCollectionBucketPath:
default: "Path to Optimization Data Collection S3 bucket"
MonthsLookback:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This only affects summary view, right? Not sure what what would be a right name here.

  • SummaryViewDefaultMonthLimit ?
  • DefaultMonthLimit ?

Also need to make it clear that updating of this parameter wont update the views/datasets/dashboards

default: "Number of months to lookback in summary_view"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another topic is days to loopback in resource_view and hourly_view. Currently 30 but customers ask to control it as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll look into that as well. Thanks!

DeployTAODashboard:
default: "Deploy TAO Dashboard"
DeployComputeOptimizerDashboard:
Expand Down Expand Up @@ -187,6 +189,11 @@ Parameters:
Description: The S3 path to the bucket created by the Cost Optimization Data Collection Lab. The path will need point to a folder containing /trusted-advisor and/or /compute-optimizer folders. You can leave the variable {account_id} in place, it will be replaced by current account ID automatically.
Default: "s3://cid-data-{account_id}"
AllowedPattern: '^s3://[a-zA-Z0-9-_{}/]*$'
MonthsLookback:
Type: String
Description: Number of months of data to capture in summary_view (used on most visuals). Valid range 7 to 24. Default=7 (6 past + 1 current). More months will require more Spice capacity in QuickSight.
Default: "7"
AllowedPattern: '\b(0?[7-9]|1[0-9]|2[0-4])\b'
Copy link
Collaborator

Choose a reason for hiding this comment

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

why limit to 24?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking we need an upper limit. Picked two years. You think we should not have one?

LambdaLayerBucketPrefix:
Type: String
Description: An S3 bucket with a Lambda layer
Expand Down Expand Up @@ -1644,6 +1651,7 @@ Resources:
quicksight-user: !Ref QuickSightUser
account-map-source: 'dummy' #initial
share-with-account: !Ref ShareDashboard
view-summary-view-monthsLookback: !Sub '${MonthsLookback}'

CUDOSDashboard:
Type: Custom::CidDashboard
Expand All @@ -1664,6 +1672,7 @@ Resources:
quicksight-user: !Ref QuickSightUser
account-map-source: 'dummy' #initial
share-with-account: !Ref ShareDashboard
view-summary-view-monthsLookback: !Sub '${MonthsLookback}'
Tags: # Hacky way to manage conditional dependencies
- Key: IgnoreNeedCostIntelligenceDashboard
Value: !If [NeedCostIntelligenceDashboard, !Ref CostIntelligenceDashboard, '']
Expand All @@ -1686,6 +1695,7 @@ Resources:
quicksight-user: !Ref QuickSightUser
account-map-source: 'dummy' #initial
share-with-account: !Ref ShareDashboard
view-summary-view-monthsLookback: !Sub '${MonthsLookback}'
Tags: # Hacky way to manage conditional dependencies
- Key: IgnoreNeedCostIntelligenceDashboard
Value: !If [NeedCostIntelligenceDashboard, !Ref CostIntelligenceDashboard, '']
Expand All @@ -1708,6 +1718,7 @@ Resources:
quicksight-user: !Ref QuickSightUser
account-map-source: 'dummy' #initial
share-with-account: !Ref ShareDashboard
view-summary-view-monthsLookback: !Sub '${MonthsLookback}'
Tags: # Hacky way to manage conditional dependencies
- Key: IgnoreNeedCostIntelligenceDashboard
Value: !If [NeedCostIntelligenceDashboard, !Ref CostIntelligenceDashboard, '']
Expand Down
4 changes: 2 additions & 2 deletions cid/builtin/core/data/queries/cid/summary_view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
FROM
"${cur_table_name}"
WHERE
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '${monthsLookback}' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '${monthsLookback}' MONTH))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,33,34
4 changes: 2 additions & 2 deletions cid/builtin/core/data/queries/cid/summary_view_ri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
FROM
"${cur_table_name}"
WHERE
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '${monthsLookback}' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '${monthsLookback}' MONTH))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,33,34
4 changes: 2 additions & 2 deletions cid/builtin/core/data/queries/cid/summary_view_sp.sql
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
FROM
"${cur_table_name}"
WHERE
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '${monthsLookback}' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '${monthsLookback}' MONTH))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,33,34
4 changes: 2 additions & 2 deletions cid/builtin/core/data/queries/cid/summary_view_sp_ri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
FROM
"${cur_table_name}"
WHERE
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '${monthsLookback}' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '${monthsLookback}' MONTH))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
4 changes: 4 additions & 0 deletions cid/builtin/core/data/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ views:
- savings_plan_savings_plan_effective_cost
- savings_plan_total_commitment_to_date
- savings_plan_used_commitment
parameters:
monthsLookback:
default: '7'
description: Number of months of data to capture in summary_view (used on most visuals). Valid range 7 to 24. Default=7 (6 past + 1 current). More months will require more Spice capacity in QuickSight.

ec2_running_cost:
spriFile: cid/ec2_running_cost_sp_ri.sql
Expand Down
Loading