In Django application, '/metrics' unaccessible when using Unix Domain Sockets
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- nginx, python
- Ambito
- backend, networking, observability
Direzione di ricerca
Inizia con i blocchi location di NGINX e la configurazione dello scrape target di Prometheus mostrati nell’issue, quindi confronta la configurazione dell’Unix domain socket con la configurazione TCP funzionante di Gunicorn. Determina se il metrics endpoint supporta questo percorso di deployment e documenta una configurazione verificata oppure la limitazione necessaria.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Im using the django_prometheus library which is a wrapper for prometheus_client library for my Django app. I am not running Prometheus, (or the entire applcaition in a Docker container), which might be part of my problem, though I dont see why this would be a requirement. The Django application is bound to Unix Domain Sockets,. NGINX is listening on default port 80 and re-routes traffic with the proxy_pass header.
NGINX
server {
server_name hotname www.hostname ip;
[...]
location /metrics{
proxy_pass http://<unix_domain_socket>;
}
location / {
proxy_pass http://unix:<unix_domain_socket>;
}
prometheus
<default prom config>
[...]
static_configs:
- targets: ["localhost:9090"]
- job_name: "django-app"
scrape_interval: 10s
static_configs:
- targets: ["localhost] # nothing works (IP, etc..) and prometheus attempts to use port 80 with a predefined scheme of http://
- job_name: "node"
scrape_interval: 10s
static_configs:
- targets: ["localhost:9100"]
Solution
By removing the unix domain socket in NGINX and going back to TCP/IP that gunicorn uses by default, Prometheus was able to successfully pickup metrics from /metrics
Is there something Im missing? I feel like the only other options are changing the whole infrastructure ( to docker), or try and use a log based-metrics.
- Lingua principale
- Python
- Stelle
- 4.4k
- Fork
- 876
- Merge medio
- 8g 4h
- PR unite (30g)
- 1
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di prometheus/client_python
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
prometheus/client_python#1177 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
prometheus/client_python#1210 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 58/100
prometheus/client_python#1199 · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
prometheus/client_python#1176 ·
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 52/100
prometheus/client_python#1126 · 2 commenti ·
Tutte le issue di prometheus/client_python
Issue simili
-
essnmx good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
[Feature] 奇物选择添加优先级 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Giskard-AI/giskard-oss#2840 · 1 commento ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Apertaarea: repo bug perceived difficulty: 2
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
yeti-platform/yeti#1380 ·