Skip to content

Commit 06814b4

Browse files
authored
Fix user costs grafana dashboard after introducing group costs (#93)
* Sum users by first value to avoid double-counting for groups
1 parent 03ed287 commit 06814b4

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

dashboards/cloud-cost-users.jsonnet

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,41 @@ local Hub =
211211
])
212212
+ bc.panelOptions.withRepeat('hub_user')
213213
+ bc.panelOptions.withRepeatDirection('v')
214+
+ bc.queryOptions.withTransformations([
215+
bc.queryOptions.transformation.withId('formatTime')
216+
+ bc.queryOptions.transformation.withOptions({
217+
"outputFormat": "MMM DD",
218+
"timeField": "Date",
219+
"timezone": "utc",
220+
"useTimezone": true
221+
}),
222+
bc.queryOptions.transformation.withId('groupBy')
223+
+ bc.queryOptions.transformation.withOptions({
224+
fields: {
225+
Cost: {
226+
aggregations: [
227+
'firstNotNull',
228+
],
229+
operation: 'aggregate',
230+
},
231+
Date: {
232+
"aggregations": [],
233+
"operation": "groupby"
234+
},
235+
User: {
236+
"aggregations": [],
237+
"operation": "groupby"
238+
},
239+
},
240+
}),
241+
bc.queryOptions.transformation.withId('groupingToMatrix')
242+
+ bc.queryOptions.transformation.withOptions({
243+
"columnField": "User",
244+
"emptyValue": "zero",
245+
"rowField": "Date",
246+
"valueField": "Cost (firstNotNull)"
247+
})
248+
])
214249
;
215250

216251
dashboard.new('User cloud costs')

0 commit comments

Comments
 (0)