Skip to content

Usage within multiprocess environment (like gunicorn) #34

@jonathanq

Description

@jonathanq

Is there any way to use this library within a multiprocess environment, like when run with Gunicorn (with workers > 1).

Currently each process will collect metrics - and if you want to expose them with Flask statsHandler, it will fail to bind due to all using the same port. This can be disabled or fixed by doing your own stats handler.

However the metrics which are gathered would be per-process. If you enable the graphite writer, each process will write out metrics with the same hostname and then clobber the other processes.

Is there a way around this?

Only (quick) idea I have come up with is using PID of each process to uniquely prefix the metrics. But then when a process is restarted, it will cause lots of extra data to be written on Graphite server.

I am looking into using the gunicorn hooks as well - but wanted to check here first if this is something already solved?

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