Skip to content

Commit

Permalink
feat: add metric labels
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperHG90 committed Mar 19, 2024
1 parent a42f66d commit 69e0656
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions infra/metrics.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,44 @@
locals {
metric_labels = [
{
key = "job_name"
description = "The name of the job."
},
{
key = "location"
description = "The dagster user location of the job."
},
{
key = "dagster_backfill"
description = "The dagster backfill of the job, if value is created by a backfill job run."
},
{
key = "dagster_partition"
description = "The dagster partition of the job, if value is created by a partitioned job run."
},
{
key = "environment"
description = "The environment in which the job ran."
},
{
key = "dagster_schedule_name"
description = "The name of the schedule that triggered the job, if value is created by a scheduled job."
}
]
}

resource "google_monitoring_metric_descriptor" "dagster_jobs" {
description = "Successful dagster jobs."
display_name = "dagster-jobs"
type = "custom.googleapis.com/dagster/job_success"
metric_kind = "GAUGE"
value_type = "BOOL"
labels {
key = "job_name"
value_type = "STRING"
description = "The name of the job."
dynamic "labels" {
for_each = local.metric_labels
content {
key = labels.value["key"]
value_type = "STRING"
description = labels.value["description"]
}
}
}

0 comments on commit 69e0656

Please sign in to comment.