In Django application, '/metrics' unaccessible when using Unix Domain Sockets
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- nginx, python
調査の方向性
Issue に示されている NGINX の location ブロックと Prometheus の scrape target 設定から始め、次に Unix domain socket のセットアップを、動作している Gunicorn TCP セットアップと比較します。metrics endpoint がこのデプロイパスをサポートしているかを判断し、検証済みの設定、または必要な制限事項を文書化します。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 4.4k
- フォーク
- 876
- 平均マージ
- 8日 4時間
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
prometheus/client_python のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
prometheus/client_python#1177 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
prometheus/client_python#1210 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 58/100
prometheus/client_python#1199 · リアクション 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
prometheus/client_python#1176 ·
-
難易度 1/5 1〜3時間 初心者へのやさしさ 52/100
prometheus/client_python#1126 · コメント 2 件 ·
prometheus/client_python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
anthropics/skills#1811 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
speaches-ai/speaches#678 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
datalayer/mcp-compose#42 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
conda-forge/spacy-feedstock#177 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
UKGovernmentBEIS/inspect_evals#2523 ·