I have connected grafana and prometheus in docker, but why is my crud application not displayed in prometheus?
my docker compose
crud:
build:
context: .
container_name: crud_app
env_file:
- .env-non-dev
depends_on:
- db
- redis
command: sh -c "alembic upgrade head && gunicorn main:app --workers 1 --worker-class uvicorn.workers.UvicornWorker --bind=0.0.0.0:8000"
ports:
- 7777:8000
prometheus:
image: prom/prometheus:v2.43.0
container_name: prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yaml
- prometheusdata:/prometheus
restart: unless-stopped
ports:
- 9090:9090
my prometheus.yml
global:
scrape_interval: 15s
external_labels:
monitor: 'codelab-monitor'
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
- job_name: 'crud'
scrape_interval: 5s
static_configs:
- targets: ['crud:8000']
when I connect at 127.0.0.1:9090 , then there are only one metrics from prometheus http://localhost:9090/metrics, and there is no my crud/metrics
I tried crud instead:8000 specify 127.0.0.1:8000
New contributor
Deppy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.