k8spin / prometheus-multi-tenant-proxy

Prometheus multi-tenant Proxy. Needed to deploy Prometheus in a multi-tenant way
GNU General Public License v3.0
67 stars 13 forks source link

Extend configuration for exported labels or metrics without labels #117

Open xhejtman opened 1 month ago

xhejtman commented 1 month ago

Hello,

would it be possible to implement extended configuration so that some of metrics are not subject of label injections? Such as kube_node_labels do not use namespaces. So such metrics could be whitelisted in configuration.

Or there are some metrics that use exported_namespace instead of namespace. Could be such metrics listed so that label injector injects the exported_namespace instead of the namespace? Thanks.

angelbarrera92 commented 3 days ago

I agree on the feature of modifying the injection label. By default it is namespace, and sometimes metrics uses exported_namespace among others.

Do you want to implement it?

xhejtman commented 3 days ago

I tried to implement it by myself, but I had to hack original prometheus code. I did not know how to do it in clean way. E.g., if request combines both namespace and exported_namespace metrics.

Do you have any better idea?

angelbarrera92 commented 1 day ago

I was thinking about using either exported_namespace or namespace

angelbarrera92 commented 1 day ago

Probably by using a cli flag like --namespace-label=namespace (default value: namespace)

xhejtman commented 1 day ago

OK, I see, but in such a case, it does not help a lot unless you run like 3 proxies, one for generic metrics (like node labels), one for exported_namespaces and one for namespaces. I would prefer to integrate them into a single one.

And I think this is actually doable right now using lables instead of namespaces.