Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent metrics with Django + uwsgi #110

Closed
rhazdon opened this issue Jul 15, 2019 · 2 comments

Comments

@rhazdon
Copy link

commented Jul 15, 2019

Hi!

First of all: Thanks for the work and effort for the project.

In my last app I noticed a relatively strange behavior: Counting metrics is not consistent.

As an example I have the metric django_http_responses_total_by_status_total. This works as expected and then suddenly drops a few hundred to a thousand counts. With the next request on /metrics the count returns to the value before and keeps on counting.

As caching backend I use a Redis.

This is how the query django_http_requests_total_by_method_total{job="my_app"} looks like:
Metrics

Since I don't want to exclude that it has something to do with my uwsgi configuration, here this one again.

Does anyone have any idea what might be going on here?

[uwsgi]
master = true

username = www-data
chdir = /opt/app/

env = DJANGO_SETTINGS_MODULE=app.settings.prod
env = SENTRY_ENVIRONMENT=production
module = app.wsgi:application

pidfile = /var/run/app/uwsgi.pid
socket = /var/run/app/uwsgi.sock
chown-socket = www-data:www-data
chmod-socket = 660

vacuum = true
die-on-term = true
emperor = true
enable-threads = true

processes = 2
threads = 4
workers = 2
@rhazdon

This comment has been minimized.

Copy link
Author

commented Jul 16, 2019

This is another sample.

Query: sum(django_http_responses_total_by_status_total{job="my_app"})

Metrics

@rhazdon

This comment has been minimized.

Copy link
Author

commented Jul 20, 2019

I found my issue. There were two options missing in my config:

env = prometheus_multiproc_dir=prometheus_multi
lazy-apps = true

Now it works like a charm. :)

@rhazdon rhazdon closed this Jul 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.