Add 'namespace' parameter to GCCollector and PlatformCollector#788
Add 'namespace' parameter to GCCollector and PlatformCollector#788arthurlm wants to merge 1 commit intoprometheus:masterprometheus/client_python:masterfrom
Conversation
This allow setting custom namespace when you need to export data using pushgateway. Parameter was already there in ProcessCollector. Signed-off-by: Arthur LE MOIGNE <arthur.lemoigne@gmail.com>
csmarchbanks
left a comment
There was a problem hiding this comment.
Thank you for the PR.
It is considered an anti-pattern to add a namespace in front of python for these metrics so I am hesitant to accept this pull request. It is best to differentiate the GC/python info using labels instead of adding a prefix so that you can compare across jobs, as well as avoid exploding the number of metric names loaded by typeahead in the Prometheus UI/Grafana.
The reason namespace is a parameter on the process collector is that it can be used to also collect information about other processes running on the host.
|
Thanks for your answer ! The reason of this PR is that in my Prometheus there are thousands of different metrics. There is few "system" processes running, which export standard metrics like In the case I was facing, a lot of distinct python application are running but there is no point to compare them together (since they are doing completely different things). Prefixing
As I said above, I have address this issue using labels (so now I am comparing You are totally free to close or merge this PR 😀
|
|
Glad the dedicated labels are working for you, |
|
Well, I am using the textfile collector pattern (so my python apps write to a textfile for node exporter to scrape). I first thought "okay, let's namespace / prefix" my daemons (like explained above). Okay, learned that this is not the recommended way. The way to go is using additional labels. Fine. Now I need help: How to add those labels in my case?
Is there a recommended way to add labels to existing collectors when using the textfile collector pattern? |
This allow setting custom namespace when you need to export data using pushgateway.
Parameter was already there in
ProcessCollector.