Replies: 5 comments
-
This would basically mean that process_open_fds becomes an ephemeral metric, with a new time series generated each time a process restarts. |
Beta Was this translation helpful? Give feedback.
-
Thanks for this proposal! I think we have a clear answer here because there is a simple rule: If the labels are to identify the target (target metadata): Appended on your service discovery on scrape time. The reason is that at the scraping time you can agree on one naming convention, one way of representing PIDs etc. You can survive a case when an application has this PID, but another not, because of the old version of IMO the cmd name and PID are such target metadata. They describe the SOURCE of data, not actually metadata about the categories of data). Does this help @hzzb - is this something you can do with your service discovery? (: |
Beta Was this translation helpful? Give feedback.
-
@hzzb how do you scrape the metrics from the various forked processes? I mean, they have to bind to a different port, each. And thus, they will get a different @bwplotka how about turning this into a discussion, now that we have them? |
Beta Was this translation helpful? Give feedback.
-
Ahaha. Thanks for reminding and suggesting! More details about my situation. One executable starts up and forks out several subprocesses. They listen on same When This scenario needs some subprocess-specific labels to distinguish metrics between subprocesses. Of course, these extra labels could be appended in the special http handler. But I'm wondering if this could be a builtin. A switch flag may be needed too to switch off this builtin for non-multiprocess users. |
Beta Was this translation helpful? Give feedback.
-
The one subprocess that serves the metrics could collect the metrics from the other sub processes in separate custom collectors or even registries. You can then use building blocks like https://pkg.go.dev/github.com/prometheus/[email protected]/prometheus#WrapRegistererWith and https://pkg.go.dev/github.com/prometheus/[email protected]/prometheus#Gatherers . See also Feel free to plug together a solution that works for you but I don't think prometheus/client_golang should have built-in first-class support for multi-process scenarios. Those are IMHO extremely rare in Go (where you usually use coroutines), and forking a Go program is not for the faint of heart anyway. |
Beta Was this translation helpful? Give feedback.
-
In many situations, we often need to:
Basic metrics has no determined labels to identify which process exported them, they all look like this:
what's we really want is:
Its feasible for users to add custom labels to every metric, but that would be a lot of redundant code. so making these two labels builtin really helps.
How do you guys think this? I would like to make it works with a minor patch.
Beta Was this translation helpful? Give feedback.
All reactions