diff --git a/gcp/modules/monitoring/rekorv2/lb/slo.tf b/gcp/modules/monitoring/rekorv2/lb/slo.tf new file mode 100644 index 0000000..95eba4c --- /dev/null +++ b/gcp/modules/monitoring/rekorv2/lb/slo.tf @@ -0,0 +1,43 @@ +/** + * Copyright 2025 The Sigstore Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module "slos" { + source = "../slo" + count = var.create_slos ? 1 : 0 + + project_id = var.project_id + project_number = var.project_number + service_id = "rekor_v2_global_lb_view" + display_name = "Rekor V2 Reads" + resource_name = "" # no telementry, this isn't a service + notification_channels = local.notification_channels + + availability_slos = { + gcs-read-availability = { + display_prefix = "Rekor V2 Availability" + base_total_service_filter = "metric.type=\"loadbalancing.googleapis.com/https/request_count\" resource.type=\"https_lb_rule\"" + # Only count 500s as server errors since clients can trigger 400s. + bad_filter = "metric.labels.response_code=monitoring.regex.full_match(\"5[0-9][0-9]\")" + slos = { + api-v2-read = { + display_suffix = "/api/v2/{path=**} - GCS Reads" + label_filter = "resource.labels.forwarding_rule_name=monitoring.regex.full_math(\".*-rekor-https-forwarding-rule\") resource.labels.matched_url_path_rule=\"/api/v2/{path=**}\"" + goal = 0.995 + }, + } + } + } +} diff --git a/gcp/modules/monitoring/rekorv2/lb/variables.tf b/gcp/modules/monitoring/rekorv2/lb/variables.tf index de1ed7f..7e5e5c1 100644 --- a/gcp/modules/monitoring/rekorv2/lb/variables.tf +++ b/gcp/modules/monitoring/rekorv2/lb/variables.tf @@ -41,3 +41,9 @@ variable "frozen_shards" { type = list(string) default = [] } + +variable "create_slos" { + description = "True to enable SLO creation" + type = bool + default = false +}