Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coralogix version >=2.0 alerts missing_values fields no longer work #318

Open
hannahkimura opened this issue Feb 5, 2025 · 1 comment
Open

Comments

@hannahkimura
Copy link

Affected Resource(s)

  • coralogix_alert (METRIC)

Terraform Configuration Files

Use a base module (base metric alert ex:
`resource "coralogix_alert" "metric_alert" {
name = "${var.name} - TF"
description = var.description
priority = var.priority
enabled = var.enabled
phantom_mode = var.phantom_mode

labels = length(var.tags) == 0 ? null : var.tags
incidents_settings = {
notify_on = var.auto_resolve_alert_when_signal_disappears ? "Triggered and Resolved" : "Triggered Only"
retriggering_period = {
minutes = var.retriggering_period
}
}
type_definition = {
metric_threshold = {
metric_filter = {
promql = var.query
}
rules = [{
condition = {
threshold = var.threshold
for_over_pct = var.pct_time_window_that_signal_must_exceed_threshold
of_the_last = var.time_window
condition_type = var.condition_type
}
override = {
priority = var.priority
}
}]

  missing_values = {
    replace_with_zero       = var.missing_values_become_zero ? var.missing_values_become_zero : null
    min_non_null_values_pct = var.missing_values_become_zero ? null : var.min_non_null_values_pct
  }
}

}

notification_group = {
group_by_keys = length(var.group_by) == 0 ? null : var.group_by
webhooks_settings = [
for endpoint in var.endpoints : {
integration_id = endpoint
notify_on = var.auto_resolve_alert_when_signal_disappears ? "Triggered and Resolved" : "Triggered Only"
retriggering_period = {
minutes = var.retriggering_period
}
}
]
}
}
`

have the variables in the missing_values block be set up as:
variable "min_non_null_values_pct" { description = "The minimum percentage of the time window for which data points must exist" default = 0 type = number validation { condition = var.min_non_null_values_pct >= 0 && var.min_non_null_values_pct <= 100 error_message = "min_non_null_values_pct represents a percentage and must be between 0 and 100" } } variable "missing_values_become_zero" { default = false description = "If false (default), missing values are nulls. If true, set missing values to 0. True also OVERRIDES the min_non_null_values_pct var and renders it meaningless." type = bool }

if you have a module that doesn't pass in these variables (ie uses the defaults), we are now seeing this bug. NOTE that we did not change anything on our end, and this has been working up until today.

Here's a module example:
`module "storage_node_added" {
source = "../base_alerts/metric_alert_morethan"
description = <<-EOT
A storage node was detected. These should no longer exist as we have deprecated VLZ.

    Known issues: Every upgrade resets the storage node group. Need to apply ASG Runbook to scale these down.
EOT

name = "Storage node detected"
auto_resolve_alert_when_signal_disappears = true
priority = "P1"
query = "sum(k8s_node_condition_ready{type="storage",stage!="preview"}) by (k8s_node_name, stage)"
threshold = 0
endpoints = [var.integration_pagerduty_id, var.integration_teams_id]
group_by = ["stage"]
phantom_mode = false

}`

Again, I want to emphasize that this code has been like this for a while, and we changed nothing, but got errors today.

Image

References

  • #0000

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@hannahkimura
Copy link
Author

also, printing out what the block looks like, it looks syntactically correct:

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant