Skip to content

Commit

Permalink
cloud cost dashboard: fix repeating panels
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Oct 4, 2024
1 parent 8ee6a74 commit 4c4a5ed
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
6 changes: 2 additions & 4 deletions grafana-dashboards/common.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ local var = grafonnet.dashboard.variable;
query: "",
queryType: "infinity",
infinityQuery: {
columns: [],
filters: [],
format: "table",
parser: "backend",
refId: "variable",
root_selector: "",
source: "url",
type: "json",
url: "http://aws-ce-grafana-backend.support.svc.cluster.local/hub-names?from=${__from:date}&to=${__to:date}",
Expand All @@ -32,8 +29,9 @@ local var = grafonnet.dashboard.variable;
}
)
+ var.query.withDatasourceFromVariable(self.infinity_datasource)
+ var.query.generalOptions.showOnDashboard.withNothing()
+ var.query.selectionOptions.withIncludeAll(value=true)
+ var.query.generalOptions.showOnDashboard.withNothing()
+ var.query.refresh.onTime()
,
},
}
32 changes: 31 additions & 1 deletion grafana-dashboards/cost-attribution.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ local totalDailyCosts =
columns: [
{selector: "cost", text: "Cost", type: "number", unit: "currencyUSD"},
{selector: "date", text: "Date", type: "timestamp"}
]
],
parser: "backend",
type: "json",
source: "url",
url_options: {
"method": "GET",
"data": "",
},
}
]);

Expand Down Expand Up @@ -94,6 +101,13 @@ local totalDailyCostsPerHub =
{selector: "name", text: "Name", type: "string"},
{selector: "cost", text: "Cost", type: "number"}
],
parser: "backend",
type: "json",
source: "url",
url_options: {
"method": "GET",
"data": "",
},
}
]);

Expand Down Expand Up @@ -144,6 +158,13 @@ local totalDailyCostsPerComponent =
{selector: "name", text: "Name", type: "string"},
{selector: "cost", text: "Cost", type: "number"}
],
parser: "backend",
type: "json",
source: "url",
url_options: {
"method": "GET",
"data": "",
},
}
]);

Expand All @@ -155,6 +176,8 @@ local totalDailyCostsPerComponentAndHub =
Total daily costs per component, for ${hub}
|||
)
+ ts.panelOptions.withRepeat('hub')
+ ts.panelOptions.withMaxPerRow(2)
+ ts.options.withTooltip({ mode: 'single', sort: "none" })
+ ts.options.withLegend({
"calcs": [
Expand Down Expand Up @@ -194,6 +217,13 @@ local totalDailyCostsPerComponentAndHub =
{selector: "name", text: "Name", type: "string"},
{selector: "cost", text: "Cost", type: "number"}
],
parser: "backend",
type: "json",
source: "url",
url_options: {
"method": "GET",
"data": "",
},
}
]);

Expand Down

0 comments on commit 4c4a5ed

Please sign in to comment.