danihodovic / celery-exporter

A Prometheus exporter for Celery metrics
MIT License
399 stars 87 forks source link

How do I actually connect this to grafana? #197

Closed michaelschem closed 1 year ago

michaelschem commented 1 year ago
image

When I put the url in grafana, I get a 404:

image

The endpoint seems to produce a lot of logs

# HELP celery_task_sent_total Sent when a task message is published.
# TYPE celery_task_sent_total counter
celery_task_sent_total{hostname="web-669dd797b5-cbtnj",name="printing.tasks.execute_print_job"} 1.0
celery_task_sent_total{hostname="p1-metal",name="api_in.tasks.reprocess_cdtp_orders"} 8.0
celery_task_sent_total{hostname="p1-metal",name="banking.tasks.get_all_account_transactions"} 10.0
celery_task_sent_total{hostname="collider-7",name="api_in.tasks.reprocess_cdtp_orders"} 0.0
celery_task_sent_total{hostname="p1kube",name="banking.tasks.get_all_account_transactions"} 0.0
celery_task_sent_total{hostname="p1-metal",name="documents.tasks.auto_create_all_documents"} 8.0
celery_task_sent_total{hostname="p1",name="documents.tasks.auto_create_all_documents"} 0.0
celery_task_sent_total{hostname="p1-metal",name="robotics.tasks.collect_thermo_hygrometer_data"} 8.0
celery_task_sent_total{hostname="p1kube",name="robotics.tasks.collect_thermo_hygrometer_data"} 0.0
celery_task_sent_total{hostname="p1-metal",name="hr.tasks.apply_work_period_application_seconds"} 36.0
celery_task_sent_total{hostname="p1kube",name="hr.tasks.apply_work_period_application_seconds"} 0.0
celery_task_sent_total{hostname="p1-metal",name="covid_packaging.tasks.auto_update_suggested_weights"} 36.0
celery_task_sent_total{hostname="p1-metal",name="p1.celery.ReadyRollVin_save_garment_shrinkage"} 8.0
celery_task_sent_total{hostname="p1kube",name="p1.celery.ReadyRollVin_save_garment_shrinkage"} 0.0
celery_task_sent_total{hostname="p1kube",name="covid_packaging.tasks.auto_update_suggested_weights"} 0.0
celery_task_sent_total{hostname="p1-metal",name="p1.celery.create_amazon_orders_cron"} 36.0
celery_task_sent_total{hostname="collider-4",name="p1.celery.create_amazon_orders_cron"} 0.0
celery_task_sent_total{hostname="p1-metal",name="production.tasks.process_all_output_card_files"} 71.0
celery_task_sent_total{hostname="p1",name="production.tasks.process_all_output_card_files"} 0.0
celery_task_sent_total{hostname="p1-metal",name="gov.tasks.check_pack_data_status"} 15.0
celery_task_sent_total{hostname="p1-metal",name="garments_cutting.tasks.send_all_stranded_pvcos"} 15.0
celery_task_sent_total{hostname="p1",name="gov.tasks.check_pack_data_status"} 0.0
celery_task_sent_total{hostname="collider-9",name="garments_cutting.tasks.send_all_stranded_pvcos"} 0.0
celery_task_sent_total{hostname="celery-celery-57cf47cd46-thnfl",name="banking.tasks.get_transactions"} 36.0
danihodovic commented 1 year ago

Use https://prometheus.io/

michaelschem commented 1 year ago

@danihodovic so it goes exporter -> prometheus -> grafana

with a config in prometheus something like this?

scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ['http://10.10.20.217/metrics']
danihodovic commented 1 year ago

@danihodovic so it goes exporter -> prometheus -> grafana

with a config in prometheus something like this?

scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ['http://10.10.20.217/metrics']

Correct. Technically the arrows are reversed as Prometheus pulls data from the Celery-Exporter and Grafana pulls data from Prometheus. Your configuration looks OK.

You can use the Grafana dashboard @adinhodovic built once you have incoming metrics. It suits most deployments. https://github.com/danihodovic/celery-exporter#dashboards-and-alerts

michaelschem commented 1 year ago

Yea, gotcha. All working thanks! I can open a separate issue, but the queue filter doesn't seem to be working. It just shows no data when I select any of the queues.