Skip to content

Multiprocess mode for migration gauges #498

Open

Description

@olzhasar-reef

When using the prometheus client in the multiprocess mode, by default, Gauges export a separate timeseries per process. Therefore, migrations Gauges are exported as follows:

django_migrations_unapplied_total{connection="default",pid="26847"} 0.0
django_migrations_unapplied_total{connection="default",pid="26846"} 0.0
django_migrations_unapplied_total{connection="default",pid="26845"} 0.0
django_migrations_unapplied_total{connection="default",pid="26844"} 0.0
django_migrations_unapplied_total{connection="default",pid="26843"} 0.0
django_migrations_unapplied_total{connection="default",pid="26842"} 0.0

In a typical Django deployment with multiple processes running in parallel and periodical restarts of individual processes on top of that (e.g. by limiting the number of requests before restarting the worker in gunicorn), this quickly leads to unmanageably large /metrics/ response.

The proper way seems to be calculating the maximum value across all processes, by utilizing the corresponding multiprocess_mode param as documented here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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