Configuration Error in Alloy v1.4: “prometheus.remote_write should be capsule, got object”

Dears,

I’m configuring Alloy v1.4 to collect metrics from two hosts (MimirTest1 and MimirTest2) and forward them to Mimir in separate tenants. However, starting the service gives the error:

prometheus.remote_write.tenant_hostB should be capsule, got object

Below is the configuration section related to prometheus.scrape and forward_to:

prometheus.scrape "default" {
  targets = array.concat(
    prometheus.exporter.unix.default.targets,
    [
      { job = "MimirTest1_metrics", __address__ = "10.200.12.125:9273" },
      { job = "MimirTest2_metrics", __address__ = "10.200.12.114:9273" }
    ]
  )
  forward_to = [
    prometheus.remote_write.tenant_hostB,
    prometheus.remote_write.tenant_hostC
  ]
}

prometheus.remote_write "tenant_hostB" {
  url = "http://127.0.0.1:9009/api/v1/push"
  headers = { "X-Scope-OrgID" = "MimirTest1" }
}

prometheus.remote_write "tenant_hostC" {
  url = "http://127.0.0.1:9009/api/v1/push"
  headers = { "X-Scope-OrgID" = "MimirTest2" }
}

Could you provide guidance on resolving this error?

Thank you for your assistance.

Best regards,

It is sending it to an object when we need to specify a method on an object. Should be:

forward_to = [
    prometheus.remote_write.tenant_hostB.receiver,
    prometheus.remote_write.tenant_hostC.receiver
  ]