Hi All,
I'm trying to get an alert setup in TF in a following way:
resource "google_monitoring_alert_policy" "alert-policy-spanner-latency-high" {
project = var.project_id
display_name = "Spanner latency high"
combiner = "OR"
conditions {
display_name = "Spanner latency high"
condition_threshold {
duration = "180s"
comparison = "COMPARISON_GT"
aggregations {
alignment_period = "60s"
per_series_aligner = "ALIGN_PERCENTILE_50"
group_by_fields = [ "metric.method" ]
}
trigger {
count = 1
}
threshold_value = 5.0
}
}
notification_channels = local.default_channel
}
and I'm getting a following err no matter what I try:
Error: Error updating AlertPolicy "projects/<project_name>/alertPolicies/<alert_id>": googleapi: Error 400: Field alert_policy.conditions[0].condition_threshold.filter had an invalid value of "metric.type="
spanner.googleapis.com/api/request_latencies" AND resource.type="spanner_instance" AND metric.method!="CreateBackup"": The comparison operand: 'method' cannot be used with the prefix 'metric'.
what's absolutely strange is that in stackdriver GUI, I can click that filter extactly the way I want, it appears on the chart for alert, and even generates something that looks like a valid query:
fetch spanner_instance
| filter (metric.method != 'CreateBackup')
| align delta(1m)
| every 1m
| group_by [metric.method],
[value_request_latencies_mean: mean(value.request_latencies)]
Can you advise on what I'm doing wrong when trying to use API/TF pls ? Greetings
Nie drukuj tej wiadomości, ani innych dokumentów, jeśli nie jest to konieczne.
Operator Chmury Krajowej sp. z o. o. z siedzibą w Warszawie przy ul. Grzybowskiej 62, 00-844 Warszawa, zarejestrowana w Sądzie Rejonowym dla miasta stołecznego Warszawy w Warszawie, XII Wydział Gospodarczy Krajowego Rejestru Sądowego pod nr KRS 0000770202; NIP: 525-277-57-89 REGON: 382039032; kapitał zakładowy 120 000 000 PLN. Niniejsza wiadomość może zawierać poufną i prawnie zastrzeżoną korespondencję między naszą Spółką i Klientem. Jeżeli nie jesteście Państwo jej adresatem informujemy, że otrzymali ją Państwo omyłkowo oraz, że przeglądanie, rozpowszechnianie lub kopiowanie jest zabronione. W przypadku omyłkowego otrzymania niniejszej wiadomości, prosimy o niezwłoczne powiadomienie o tym nadawcy i trwałe usunięcie oryginału wiadomości wraz z ewentualnymi załącznikami.
Operator Chmury Krajowej sp. z o. o. with the registered office in Warsaw, ul. Grzybowska 62, 00-844 Warsaw, registered at the Capital City of Warsaw District Court in Warsaw, 12th Commercial Division of the National Court Register under KRS number 0000770202; Tax Identification Number (NIP): 525-277-57-89; REGON statistical number: 382039032; share capital: PLN 120,000,000.This message may contain a confidential and privileged communication between our Company and our Client. If you are not the intended recipient, you are hereby notified that you have received this message in error and that any use, dissemination, forwarding, or copying of this communication is strictly prohibited. If you have received this message by mistake, please notify the sender and delete the message permanently, including any attachments.