grafana / alloy

OpenTelemetry Collector distribution with programmable pipelines
https://grafana.com/oss/alloy
Apache License 2.0
1.35k stars 191 forks source link

Prometheus / Mimir : Dynamic tenant id from metric label like Loki #1471

Closed Ronan-WeScale closed 1 month ago

Ronan-WeScale commented 2 months ago

Background

Mimir support multi tenancy like Loki with header in the request, I suppose Loki.write read tenant label in the logs to replace default tenant_id in the endpoint (like Promtail does).
Today I use cortex-tenant as proxy between Prometheus and Mimir, I use writeRelabelConfig to regex the namespace label and create the tenant label. Cortex-tenant read the tenant label in metric and add the header to the request.
It could be better to implement this directly from Alloy instead use proxy only for doing that's job.

Proposal

This functionality can be implemented in prometheus.remote_write or with a specific mimir.remote_write.

wilfriedroset commented 2 months ago

@Ronan-WeScale could this be a duplicate of #521 ?

Ronan-WeScale commented 1 month ago

@wilfriedroset of course, sorry for duplicate, I tried to search before create this issue.
But https://github.com/grafana/alloy/issues/521 seem stuck from long time.