Skip to content

[RFC] include max_children in metrics #405

@leonboot

Description

@leonboot

Hi!

I've been using the php-fpm_exporter to monitor worker pool saturation for a lot of servers. So far, it has helped me numerous times to detect availability issues! It's a great addition to my toolbox. Thanks for that!

Today, I realized there is a flaw in my metric to detect worker pool saturation. I'm using the exporter to scrape metrics and use them in my Grafana dashboards. The query to determine the percentage of workers I have available to handle requests is the following:

(phpfpm_active_processes{job="phpfpm"} / phpfpm_max_active_processes{job="phpfpm"}) * 100

You may already have spotted the flaw: I expect phpfpm_max_active_processes to hold whatever the value of php-fpm's configuration value for pm.max_children is. Instead, it represents the maximum amount of active workers at a certain point in time since the FPM service was started. So an FPM service that has a max pool size of 10 and a minimum of 1 spare worker, but was never called since it was started, will have a value of 1 for the phpfpm_max_active_processes metric. And the above query will yield a value of 100%.

Would you consider adding an extra metric that represents the maximum amount of workers the pool allows, effectively the value of pm.max_children? I think this would make a sensible addition, as I can't think of any other way to determine if there is room for new workers to spawn. Or perhaps there is another way that I'm not aware of?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions