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

Formatting of local.file in format function does not return the string contents #1470

Open
ResuBaka opened this issue Aug 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ResuBaka
Copy link

What's wrong?

When you try to use the format function to crate a new string and one of the arguments is the contents of the local.file you get something like this back {%!s(bool=false) contents_of_the_file}:15692 when you use format("%s:%s", local.file.file.content, "15692"). This does not happen when you use for example join to combine both strings.

Steps to reproduce

Crate a alloy config which locks something like this as added below.

System information

No response

Software version

Grafana Alloy 1.3.0

Configuration

local.file "instance_id" {
  filename  = "/etc/alloy/instance_id.txt"
}

prometheus.scrape "default" {
  targets    = [
    {"__address__" = "127.0.0.1:15692", "instance" = format("%s:%s", local.file.instance_id.content, "15692")},
  ]
  forward_to = [prometheus.remote_write.default.receiver]
  scrape_interval = "15s"
}

Logs

No response

@ResuBaka ResuBaka added the bug Something isn't working label Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant