0

I have a dotnet container which I can't change the source code of running inside a kubernetes cluster as a deployment.

The application is sending its metrics to an otel collector configured in appsettings.json. The collector then gets its metrics scraped into prometheus.

I have multiple instances of this application running in different namespaces all sending their data to the same collector.

How can I add data held within the labels of the different deployments to the metrics that are sent to prometheus.

E.g. I have a label called "tenant" which changes between namespaces, I need this label added to the metric so I can query on it in prometheus. Or if easier if I set the container to have an environment variable set to the label value how can this be sent.

How can this be achieved?

1
  • for anyone who comes across this and also stuck, the missing piece of knowledge was that I needed to look at processors in the collector, it is possible to get a processor that can pull in kubernetes cluster info and match that will the pod that is sending in the telemetry, you can then pull labels from the pod and attach as attributes which are converted to labels in prometheus
    – mattb
    Commented Jul 9 at 17:26

0