Skip to content

Commit

Permalink
Merge pull request #45 from adamhackl/update-depreciated-stdlib-funct…
Browse files Browse the repository at this point in the history
…ions

Update depreciated stdlib functions
  • Loading branch information
mattdurham authored Dec 5, 2024
2 parents 14d9410 + c5d75a7 commit b48b00a
Show file tree
Hide file tree
Showing 31 changed files with 104 additions and 104 deletions.
6 changes: 3 additions & 3 deletions modules/broker/rabbitmq/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ declare "kubernetes" {

selectors {
role = "pod"
field = join(coalesce(argument.field_selectors.value, []), ",")
label = join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=prometheus-rabbitmq-exporter"]), ",")
field = string.join(coalesce(argument.field_selectors.value, []), ",")
label = string.join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=prometheus-rabbitmq-exporter"]), ",")
}

namespaces {
Expand Down Expand Up @@ -153,7 +153,7 @@ declare "local" {
discovery.relabel "local" {
targets = [
{
"__address__" = "localhost" + format("%s", coalesce(argument.port.value, "9419")),
"__address__" = "localhost" + string.format("%s", coalesce(argument.port.value, "9419")),
"source" = "local",
},
]
Expand Down
6 changes: 3 additions & 3 deletions modules/collector/agent/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ declare "kubernetes" {

selectors {
role = "pod"
field = join(coalesce(argument.field_selectors.value, []), ",")
label = join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=grafana-agent"]), ",")
field = string.join(coalesce(argument.field_selectors.value, []), ",")
label = string.join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=grafana-agent"]), ",")
}

namespaces {
Expand Down Expand Up @@ -154,7 +154,7 @@ declare "local" {
discovery.relabel "local" {
targets = [
{
"__address__" = "localhost" + format("%s", coalesce(argument.port.value, "12345")),
"__address__" = "localhost" + string.format("%s", coalesce(argument.port.value, "12345")),
"source" = "local",
},
]
Expand Down
4 changes: 2 additions & 2 deletions modules/collector/push-gateway/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ declare "kubernetes" {

selectors {
role = "service"
field = join(coalesce(argument.field_selectors.value, []), ",")
label = join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=prometheus-pushgateway"]), ",")
field = string.join(coalesce(argument.field_selectors.value, []), ",")
label = string.join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=prometheus-pushgateway"]), ",")
}

namespaces {
Expand Down
6 changes: 3 additions & 3 deletions modules/databases/kv/etcd/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ declare "kubernetes" {

selectors {
role = "pod"
field = join(coalesce(argument.field_selectors.value, []), ",")
label = join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/component=etcd"]), ",")
field = string.join(coalesce(argument.field_selectors.value, []), ",")
label = string.join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/component=etcd"]), ",")
}

namespaces {
Expand Down Expand Up @@ -153,7 +153,7 @@ declare "local" {
discovery.relabel "local" {
targets = [
{
"__address__" = "localhost" + format("%s", coalesce(argument.port.value, "9150")),
"__address__" = "localhost" + string.format("%s", coalesce(argument.port.value, "9150")),
"source" = "local",
},
]
Expand Down
6 changes: 3 additions & 3 deletions modules/databases/kv/memcached/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ declare "kubernetes" {

selectors {
role = "pod"
field = join(coalesce(argument.field_selectors.value, []), ",")
label = join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=memcached"]), ",")
field = string.join(coalesce(argument.field_selectors.value, []), ",")
label = string.join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=memcached"]), ",")
}

namespaces {
Expand Down Expand Up @@ -153,7 +153,7 @@ declare "local" {
discovery.relabel "local" {
targets = [
{
"__address__" = "localhost" + format("%s", coalesce(argument.port.value, "9150")),
"__address__" = "localhost" + string.format("%s", coalesce(argument.port.value, "9150")),
"source" = "local",
},
]
Expand Down
6 changes: 3 additions & 3 deletions modules/databases/kv/redis/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ declare "kubernetes" {

selectors {
role = "pod"
field = join(coalesce(argument.field_selectors.value, []), ",")
label = join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=prometheus-redis-exporter"]), ",")
field = string.join(coalesce(argument.field_selectors.value, []), ",")
label = string.join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=prometheus-redis-exporter"]), ",")
}

namespaces {
Expand Down Expand Up @@ -153,7 +153,7 @@ declare "local" {
discovery.relabel "local" {
targets = [
{
"__address__" = "localhost" + format("%s", coalesce(argument.port.value, "9150")),
"__address__" = "localhost" + string.format("%s", coalesce(argument.port.value, "9150")),
"source" = "local",
},
]
Expand Down
6 changes: 3 additions & 3 deletions modules/databases/sql/mysql/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ declare "kubernetes" {

selectors {
role = "pod"
field = join(coalesce(argument.field_selectors.value, []), ",")
label = join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=prometheus-mysql-exporter"]), ",")
field = string.join(coalesce(argument.field_selectors.value, []), ",")
label = string.join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=prometheus-mysql-exporter"]), ",")
}

namespaces {
Expand Down Expand Up @@ -154,7 +154,7 @@ declare "local" {
discovery.relabel "local" {
targets = [
{
"__address__" = "localhost" + format("%s", coalesce(argument.port.value, "9104")),
"__address__" = "localhost" + string.format("%s", coalesce(argument.port.value, "9104")),
"source" = "local",
},
]
Expand Down
6 changes: 3 additions & 3 deletions modules/databases/sql/postgres/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ declare "kubernetes" {

selectors {
role = "pod"
field = join(coalesce(argument.field_selectors.value, []), ",")
label = join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=prometheus-postgres-exporter"]), ",")
field = string.join(coalesce(argument.field_selectors.value, []), ",")
label = string.join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=prometheus-postgres-exporter"]), ",")
}

namespaces {
Expand Down Expand Up @@ -154,7 +154,7 @@ declare "local" {
discovery.relabel "local" {
targets = [
{
"__address__" = "localhost" + format("%s", coalesce(argument.port.value, "9187")),
"__address__" = "localhost" + string.format("%s", coalesce(argument.port.value, "9187")),
"source" = "local",
},
]
Expand Down
6 changes: 3 additions & 3 deletions modules/databases/timeseries/loki/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ declare "kubernetes" {

selectors {
role = "pod"
field = join(coalesce(argument.field_selectors.value, []), ",")
label = join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=loki"]), ",")
field = string.join(coalesce(argument.field_selectors.value, []), ",")
label = string.join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=loki"]), ",")
}

namespaces {
Expand Down Expand Up @@ -154,7 +154,7 @@ declare "local" {
discovery.relabel "local" {
targets = [
{
"__address__" = "localhost" + format("%s", coalesce(argument.port.value, "3000")),
"__address__" = "localhost" + string.format("%s", coalesce(argument.port.value, "3000")),
"source" = "local",
},
]
Expand Down
6 changes: 3 additions & 3 deletions modules/databases/timeseries/mimir/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ declare "kubernetes" {

selectors {
role = "pod"
field = join(coalesce(argument.field_selectors.value, []), ",")
label = join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=mimir"]), ",")
field = string.join(coalesce(argument.field_selectors.value, []), ",")
label = string.join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=mimir"]), ",")
}

namespaces {
Expand Down Expand Up @@ -154,7 +154,7 @@ declare "local" {
discovery.relabel "local" {
targets = [
{
"__address__" = "localhost" + format("%s", coalesce(argument.port.value, "8080")),
"__address__" = "localhost" + string.format("%s", coalesce(argument.port.value, "8080")),
"source" = "local",
},
]
Expand Down
6 changes: 3 additions & 3 deletions modules/databases/timeseries/pyroscope/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ declare "kubernetes" {

selectors {
role = "pod"
field = join(coalesce(argument.field_selectors.value, []), ",")
label = join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=pyroscope"]), ",")
field = string.join(coalesce(argument.field_selectors.value, []), ",")
label = string.join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=pyroscope"]), ",")
}

namespaces {
Expand Down Expand Up @@ -154,7 +154,7 @@ declare "local" {
discovery.relabel "local" {
targets = [
{
"__address__" = "localhost" + format("%s", coalesce(argument.port.value, "4040")),
"__address__" = "localhost" + string.format("%s", coalesce(argument.port.value, "4040")),
"source" = "local",
},
]
Expand Down
6 changes: 3 additions & 3 deletions modules/databases/timeseries/tempo/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ declare "kubernetes" {

selectors {
role = "pod"
field = join(coalesce(argument.field_selectors.value, []), ",")
label = join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=tempo"]), ",")
field = string.join(coalesce(argument.field_selectors.value, []), ",")
label = string.join(coalesce(argument.label_selectors.value, ["app.kubernetes.io/name=tempo"]), ",")
}

namespaces {
Expand Down Expand Up @@ -154,7 +154,7 @@ declare "local" {
discovery.relabel "local" {
targets = [
{
"__address__" = "localhost" + format("%s", coalesce(argument.port.value, "3200")),
"__address__" = "localhost" + string.format("%s", coalesce(argument.port.value, "3200")),
"source" = "local",
},
]
Expand Down
12 changes: 6 additions & 6 deletions modules/kubernetes/annotations/logs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -475,18 +475,18 @@ log_utils.post_process_metrics "default" {}
loki.write "local" {
endpoint {
url = env("LOGS_PRIMARY_URL")
url = sys.env("LOGS_PRIMARY_URL")
basic_auth {
username = env("LOGS_PRIMARY_TENANT")
password = env("LOGS_PRIMARY_TOKEN")
username = sys.env("LOGS_PRIMARY_TENANT")
password = sys.env("LOGS_PRIMARY_TOKEN")
}
}
external_labels = {
"cluster" = coalesce(env("CLUSTER_NAME"), env("CLUSTER"), ""),
"env" = coalesce(env("ENV"), ""),
"region" = coalesce(env("REGION"), ""),
"cluster" = coalesce(sys.env("CLUSTER_NAME"), sys.env("CLUSTER"), ""),
"env" = coalesce(sys.env("ENV"), ""),
"region" = coalesce(sys.env("REGION"), ""),
}
}
```
2 changes: 1 addition & 1 deletion modules/kubernetes/annotations/logs/drop.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ declare "drop_levels" {
argument "__sd_annotation" {
optional = true
comment = "The logic is used to transform the annotation argument into a valid label name by removing unsupported characters."
default = replace(replace(replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
default = string.replace(string.replace(string.replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
}

export "annotation" {
Expand Down
2 changes: 1 addition & 1 deletion modules/kubernetes/annotations/logs/embed.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ declare "embed_pod" {
argument "__sd_annotation" {
optional = true
comment = "The logic is used to transform the annotation argument into a valid label name by removing unsupported characters."
default = replace(replace(replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
default = string.replace(string.replace(string.replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
}

export "annotation" {
Expand Down
4 changes: 2 additions & 2 deletions modules/kubernetes/annotations/logs/json.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ declare "json_scrub_empties" {
argument "__sd_annotation" {
optional = true
comment = "The logic is used to transform the annotation argument into a valid label name by removing unsupported characters."
default = replace(replace(replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
default = string.replace(string.replace(string.replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
}

export "annotation" {
Expand Down Expand Up @@ -99,7 +99,7 @@ declare "json_scrub_nulls" {
argument "__sd_annotation" {
optional = true
comment = "The logic is used to transform the annotation argument into a valid label name by removing unsupported characters."
default = replace(replace(replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
default = string.replace(string.replace(string.replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
}

export "annotation" {
Expand Down
6 changes: 3 additions & 3 deletions modules/kubernetes/annotations/logs/logs.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ declare "pods" {
argument "__sd_annotation" {
optional = true
comment = "The logic is used to transform the annotation argument into a valid label name by removing unsupported characters."
default = replace(replace(replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
default = string.replace(string.replace(string.replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
}

// export the discovered targets
Expand All @@ -65,8 +65,8 @@ declare "pods" {

selectors {
role = "pod"
field = join(coalesce(argument.field_selectors.value, []), ",")
label = join(coalesce(argument.label_selectors.value, []), ",")
field = string.join(coalesce(argument.field_selectors.value, []), ",")
label = string.join(coalesce(argument.label_selectors.value, []), ",")
}

namespaces {
Expand Down
14 changes: 7 additions & 7 deletions modules/kubernetes/annotations/logs/mask.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ declare "mask_luhn" {
argument "__sd_annotation" {
optional = true
comment = "The logic is used to transform the annotation argument into a valid label name by removing unsupported characters."
default = replace(replace(replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
default = string.replace(string.replace(string.replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
}

export "annotation" {
Expand Down Expand Up @@ -106,7 +106,7 @@ declare "mask_credit_card" {
argument "__sd_annotation" {
optional = true
comment = "The logic is used to transform the annotation argument into a valid label name by removing unsupported characters."
default = replace(replace(replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
default = string.replace(string.replace(string.replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
}

export "annotation" {
Expand Down Expand Up @@ -177,7 +177,7 @@ declare "mask_email" {
argument "__sd_annotation" {
optional = true
comment = "The logic is used to transform the annotation argument into a valid label name by removing unsupported characters."
default = replace(replace(replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
default = string.replace(string.replace(string.replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
}

export "annotation" {
Expand Down Expand Up @@ -242,7 +242,7 @@ declare "mask_ipv4" {
argument "__sd_annotation" {
optional = true
comment = "The logic is used to transform the annotation argument into a valid label name by removing unsupported characters."
default = replace(replace(replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
default = string.replace(string.replace(string.replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
}

export "annotation" {
Expand Down Expand Up @@ -307,7 +307,7 @@ declare "mask_ipv6" {
argument "__sd_annotation" {
optional = true
comment = "The logic is used to transform the annotation argument into a valid label name by removing unsupported characters."
default = replace(replace(replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
default = string.replace(string.replace(string.replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
}

export "annotation" {
Expand Down Expand Up @@ -372,7 +372,7 @@ declare "mask_phone" {
argument "__sd_annotation" {
optional = true
comment = "The logic is used to transform the annotation argument into a valid label name by removing unsupported characters."
default = replace(replace(replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
default = string.replace(string.replace(string.replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
}

export "annotation" {
Expand Down Expand Up @@ -437,7 +437,7 @@ declare "mask_ssn" {
argument "__sd_annotation" {
optional = true
comment = "The logic is used to transform the annotation argument into a valid label name by removing unsupported characters."
default = replace(replace(replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
default = string.replace(string.replace(string.replace(coalesce(argument.annotation.value, "logs.grafana.com"),".", "_"),"/", "_"),"-", "_")
}

export "annotation" {
Expand Down
Loading

0 comments on commit b48b00a

Please sign in to comment.