forked from grafana/grafonnet-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudmonitoring.libsonnet
57 lines (55 loc) · 1.5 KB
/
cloudmonitoring.libsonnet
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
/**
* Creates a [Google Cloud Monitoring target](https://grafana.com/docs/grafana/latest/datasources/google-cloud-monitoring/)
*
* @name cloudmonitoring.target
*
* @param metric
* @param project
* @param filters (optional)
* @param groupBys (optional)
* @param period (default: `'cloud-monitoring-auto'`)
* @param crossSeriesReducer (default 'REDUCE_MAX')
* @param valueType (default 'INT64')
* @param perSeriesAligner (default 'ALIGN_DELTA')
* @param metricKind (default 'CUMULATIVE')
* @param unit (optional)
* @param alias (optional)
* @return Panel target
*/
target(
metric,
project,
filters=[],
groupBys=[],
period='cloud-monitoring-auto',
crossSeriesReducer='REDUCE_MAX',
valueType='INT64',
perSeriesAligner='ALIGN_DELTA',
metricKind='CUMULATIVE',
unit=1,
alias=null,
):: {
metricQuery: {
[if alias != null then 'aliasBy']: alias,
alignmentPeriod: period,
crossSeriesReducer: crossSeriesReducer,
[if filters != null then 'filters']: filters,
[if groupBys != null then 'groupBys']: groupBys,
metricKind: metricKind,
metricType: metric,
perSeriesAligner: perSeriesAligner,
projectName: project,
unit: unit,
valueType: valueType,
},
sloQuery: {
[if alias != null then 'aliasBy']: alias,
alignmentPeriod: period,
projectName: project,
selectorName: 'select_slo_health',
serviceId: '',
sloId: '',
},
},
}