File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Execute in cloud shell
3+ ACCESS_TOKEN=$( gcloud auth print-access-token)
4+ CREATE_SLO_POST_BODY=$( cat << EOF
5+ {
6+ "displayName": "99% - Good/Bad Ratio - Rolling 30 days",
7+ "goal": 0.99,
8+ "rollingPeriod": "86400s",
9+ "serviceLevelIndicator": {
10+ "requestBased": {
11+ "goodTotalRatio": {
12+ "goodServiceFilter": "metric.type=\"logging.googleapis.com/user/200-functions\" resource.type=\"cloud_function\"",
13+ "badServiceFilter": "metric.type=\"logging.googleapis.com/user/errored-functions\" resource.type=\"cloud_function\""
14+ }
15+ }
16+ }
17+ }
18+ EOF
19+ )
20+
21+ curl --http1.1 --header " Authorization: Bearer $ACCESS_TOKEN " --header " Content-Type: application/json" -X POST -d " $CREATE_SLO_POST_BODY " " https://monitoring.googleapis.com/v3/projects/$GOOGLE_CLOUD_PROJECT /services/_1QdRovaRBGqDhnMI8i2Yw/serviceLevelObjectives"
You can’t perform that action at this time.
0 commit comments