Open Cuda-Chen opened 3 years ago
Hello! Can't understand why my prometheus have no dramatiq metrics Did you solve this problem?
Can't understand why my prometheus have no dramatiq metrics
It means that Prometheus does not show any metrics of dramatiq
.
Did you solve this problem?
I solve the problem. However, I opened this issue about two years ago, so I barely remember the way I solve this problem.
If I do not remember anything wrong, I just forget to actually open the ports in my docker-compose
settings.
@Cuda-Chen Do you have a repo of these code ?
@k578fgr taking the following docker-compose.yml
as example:
worker:
# Use Dockerfile of your Django app
build: .
environment:
- dramatiq_prom_host=worker
- dramatiq_prom_port=9191
- prometheus_multiproc_dir=/tmp/dramatiq-prometheus
- dramatiq_prom_db=/tmp/dramatiq-prometheus
-
command: bash -c "
mkdir -p /tmp/dramatiq-prometheus
&& rm -rf /tmp/dramatiq-prometheus/*
&& python manage.py migrate django_dramatiq
&& python manage.py rundramatiq --threads 1"
ports:
- "9191:9191"
depends_on:
# I use rabbitmq as broker
- rabbitmq
I am using using
django_dramatiq
in Docker. Now I would like to export the prometheus metrics describe in https://dramatiq.io/advanced.html#prometheus-metrics However, when I tried to watch the metrics of dramatiq it only shows Django-specific metrics:For further information, here are some settings of my app:
settings.py
DRAMATIQ_BROKER = { "BROKER": "dramatiq.brokers.rabbitmq.RabbitmqBroker", "OPTIONS": { "url": "",
},
"MIDDLEWARE": [
"dramatiq.middleware.Prometheus",
"dramatiq.middleware.AgeLimit",
"dramatiq.middleware.TimeLimit",
"dramatiq.middleware.Callbacks",
"dramatiq.middleware.Retries",
"django_dramatiq.middleware.DbConnectionsMiddleware",
"django_dramatiq.middleware.AdminMiddleware",
]
}
DRAMATIQ_TASKS_DATABASE = "default"
MIDDLEWARE = [ 'django_prometheus.middleware.PrometheusBeforeMiddleware', 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django_prometheus.middleware.PrometheusAfterMiddleware', ]
Thanks for your help!