Hello all!
We have Alloy running in our AKS cluster, deployed using the Helm chart.
I’m trying to add some more scraping functionality and improving security by using secrets. However, I’m running into some issues with the standard library. I was trying to use sys.env
to get my secrets that are mounted as environment variables in the pod, but I’m receiving this error on startup:
alloy Error: /etc/alloy/config.alloy:63:20: component "sys.env" does not exist or is out of scope
alloy
alloy 62 | basic_auth {
alloy 63 | username = sys.env("TIMESCALE_USER")
alloy | ^^^^^
alloy 64 | password = sys.env("TIMESCALE_PASSWORD")
alloy
alloy Error: /etc/alloy/config.alloy:64:20: component "sys.env" does not exist or is out of scope
alloy
alloy 63 | username = sys.env("TIMESCALE_USER")
alloy 64 | password = sys.env("TIMESCALE_PASSWORD")
alloy | ^^^^^
alloy 65 | }
alloy
alloy Error: could not perform the initial load successfully
Stream closed EOF for monitoring/monitoring-alloy-66j2j (alloy)
This is the config itself, I’ll just share the relevant part:
prometheus.scrape "timescale" {
job_name = "integrations/timescale"
targets = [
{"__address__" = "<super-secret-url>:9273", "instance" = "dev"},
]
scrape_interval = "60s"
basic_auth {
username = sys.env("TIMESCALE_USER")
password = sys.env("TIMESCALE_PASSWORD")
}
forward_to = [prometheus.remote_write.mimir.receiver]
}
I can confirm that the environment variables are mounted, though that shouldn’t even matter since the docs say that if they aren’t found, the function should return an empty string.
I’ve also tried using remote.kubernetes.secret, but it requires the convert.nonsensitive
function, which throws the exact same component <name> does not exist or is out of scope
error.
I guess I might just be missing something obvious, but none of the examples I’ve found in the docs have mentioned anything about them have to be enabled or something like that.
I’ve done my due dilligence and scoured this community and GitHub for similar issues wit these function but I haven’t found any, which makes me think it’s a bug, or I’m missing something really obvious.
Thanks in advance for any input!