Skip to content

Commit

Permalink
Add window based SLI (GoogleCloudPlatform#3510)
Browse files Browse the repository at this point in the history
* add window based SLI

* comment
  • Loading branch information
emilymye authored and Nathan Klish committed May 18, 2020
1 parent ed44c35 commit d474f31
Show file tree
Hide file tree
Showing 7 changed files with 952 additions and 91 deletions.
348 changes: 344 additions & 4 deletions products/monitoring/api.yaml

Large diffs are not rendered by default.

52 changes: 49 additions & 3 deletions products/monitoring/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,32 @@ overrides: !ruby/object:Overrides::ResourceOverrides
test_env_vars:
project: :PROJECT_NAME
vars:
service_id: "custom-srv"
service_id: "custom-srv-request-slos"
slo_id: "consumed-api-slo"
- !ruby/object:Provider::Terraform::Examples
name: 'monitoring_slo_windows_based_good_bad_metric_filter'
primary_resource_id: "windows_based"
vars:
service_id: "custom-srv-windows-slos"
slo_id: "good-bad-metric-filter"
- !ruby/object:Provider::Terraform::Examples
name: 'monitoring_slo_windows_based_metric_mean'
primary_resource_id: "windows_based"
vars:
service_id: "custom-srv-windows-slos"
slo_id: "metric-mean-range"
- !ruby/object:Provider::Terraform::Examples
name: 'monitoring_slo_windows_based_metric_sum'
primary_resource_id: "windows_based"
vars:
service_id: "custom-srv-windows-slos"
slo_id: "metric-sum-range"
- !ruby/object:Provider::Terraform::Examples
name: 'monitoring_slo_windows_based_ratio_threshold'
primary_resource_id: "windows_based"
vars:
service_id: "custom-srv-windows-slos"
slo_id: "ratio-threshold"
properties:
rollingPeriodDays: !ruby/object:Overrides::Terraform::PropertyOverride
api_name: rollingPeriod
Expand Down Expand Up @@ -178,9 +202,31 @@ overrides: !ruby/object:Overrides::ResourceOverrides
- "serviceLevelIndicator.requestBased.goodTotalRatio.badServiceFilter"
- "serviceLevelIndicator.requestBased.goodTotalRatio.goodServiceFilter"
- "serviceLevelIndicator.requestBased.goodTotalRatio.totalServiceFilter"
- "serviceLevelIndicator.requestBased.distributionCut.range.min"
- "serviceLevelIndicator.requestBased.distributionCut.range.max"
- "serviceLevelIndicator.requestBased.distributionCut.range"
- "serviceLevelIndicator.requestBased.distributionCut.distributionFilter"
serviceLevelIndicator.windowsBasedSli: !ruby/object:Overrides::Terraform::PropertyOverride
# Force update nested fields to allow for unsetting values.
update_mask_fields:
- "serviceLevelIndicator.windowsBased.windowPeriod"
- "serviceLevelIndicator.windowsBased.goodBadMetricFilter"
- "serviceLevelIndicator.windowsBased.goodTotalRatioThreshold.threshold"
- "serviceLevelIndicator.windowsBased.goodTotalRatioThreshold.performance.goodTotalRatio.badServiceFilter"
- "serviceLevelIndicator.windowsBased.goodTotalRatioThreshold.performance.goodTotalRatio.goodServiceFilter"
- "serviceLevelIndicator.windowsBased.goodTotalRatioThreshold.performance.goodTotalRatio.totalServiceFilter"
- "serviceLevelIndicator.windowsBased.goodTotalRatioThreshold.performance.distributionCut.range"
- "serviceLevelIndicator.windowsBased.goodTotalRatioThreshold.performance.distributionCut.distributionFilter"
- "serviceLevelIndicator.windowsBased.goodTotalRatioThreshold.basicSliPerformance"
- "serviceLevelIndicator.windowsBased.metricMeanInRange.timeSeries"
- "serviceLevelIndicator.windowsBased.metricMeanInRange.range"
- "serviceLevelIndicator.windowsBased.metricSumInRange.timeSeries"
- "serviceLevelIndicator.windowsBased.metricSumInRange.range"
serviceLevelIndicator.windowsBasedSli.goodTotalRatioThreshold.basicSliPerformance.method: !ruby/object:Overrides::Terraform::PropertyOverride
is_set: true
serviceLevelIndicator.windowsBasedSli.goodTotalRatioThreshold.basicSliPerformance.location: !ruby/object:Overrides::Terraform::PropertyOverride
is_set: true
serviceLevelIndicator.windowsBasedSli.goodTotalRatioThreshold.basicSliPerformance.version: !ruby/object:Overrides::Terraform::PropertyOverride
is_set: true

custom_code: !ruby/object:Provider::Terraform::CustomCode
constants: templates/terraform/constants/monitoring_slo.go.erb
custom_import: templates/terraform/custom_import/self_link_as_name.erb
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "google_monitoring_custom_service" "customsrv" {
service_id = "<%= ctx[:vars]['service_id'] %>"
display_name = "My Custom Service"
}

resource "google_monitoring_slo" "<%= ctx[:primary_resource_id] %>" {
service = google_monitoring_custom_service.customsrv.service_id
display_name = "Terraform Test SLO with window based SLI"

goal = 0.95
calendar_period = "FORTNIGHT"

windows_based_sli {
window_period = "400s"
good_bad_metric_filter = join(" AND ", [
"metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\"",
"resource.type=\"uptime_url\"",
])
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
resource "google_monitoring_custom_service" "customsrv" {
service_id = "<%= ctx[:vars]['service_id'] %>"
display_name = "My Custom Service"
}

resource "google_monitoring_slo" "<%= ctx[:primary_resource_id] %>" {
service = google_monitoring_custom_service.customsrv.service_id
display_name = "Terraform Test SLO with window based SLI"

goal = 0.9
rolling_period_days = 20

windows_based_sli {
window_period = "600s"
metric_mean_in_range {
time_series = join(" AND ", [
"metric.type=\"agent.googleapis.com/cassandra/client_request/latency/95p\"",
"resource.type=\"gce_instance\"",
])

range {
max = 5
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
resource "google_monitoring_custom_service" "customsrv" {
service_id = "<%= ctx[:vars]['service_id'] %>"
display_name = "My Custom Service"
}

resource "google_monitoring_slo" "<%= ctx[:primary_resource_id] %>" {
service = google_monitoring_custom_service.customsrv.service_id
display_name = "Terraform Test SLO with window based SLI"

goal = 0.9
rolling_period_days = 20

windows_based_sli {
window_period = "400s"
metric_sum_in_range {
time_series = join(" AND ", [
"metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\"",
"resource.type=\"uptime_url\"",
])

range {
max = 5000
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
resource "google_monitoring_custom_service" "customsrv" {
service_id = "<%= ctx[:vars]['service_id'] %>"
display_name = "My Custom Service"
}

resource "google_monitoring_slo" "<%= ctx[:primary_resource_id] %>" {
service = google_monitoring_custom_service.customsrv.service_id
display_name = "Terraform Test SLO with window based SLI"

goal = 0.9
rolling_period_days = 20

windows_based_sli {
window_period = "100s"

good_total_ratio_threshold {
threshold = 0.1
performance {
distribution_cut {
distribution_filter = join(" AND ", [
"metric.type=\"serviceruntime.googleapis.com/api/request_latencies\"",
"resource.type=\"consumed_api\"",
])

range {
min = 1
max = 9
}
}
}
}
}
}
Loading

0 comments on commit d474f31

Please sign in to comment.