Skip to content
Snippets Groups Projects
Select Git revision
  • 9d87a64a827fcbb5b2e8dbde32398fad0cc5bf6a
  • main default protected
2 results

django-prometheus

  • Open with
  • Download source code
  • Your workspaces

      A workspace is a virtual sandbox environment for your code in GitLab.

      No agents available to create workspaces. Please consult Workspaces documentation for troubleshooting.

  • Jan David Mol's avatar
    Jan David Mol authored
    9d87a64a
    History

    Docker Deploy: Grafana

    Demo

    This repo contains a demo setup for the django-prometheus plugin, which exposes Django usage metrics as a Prometheus end point. See their README on how to use it.

    Spin up

    To build and spin up the demo environment:

    docker-compose build
    docker-compose up

    Once the stack has booted up, you can visit:

    You will see that the django-prometheus plugin will expose general statistics like:

    • Backend database performance,
    • HTTP response times,
    • CRUD operations on models that have been extended with the ExportModelOperationsMixin class.

    Example metric exposed by this plugin (for a full list see example-exposed-metrics.txt):

    # HELP django_model_inserts_total Number of insert operations by model.
    # TYPE django_model_inserts_total counter
    django_model_inserts_total{model="question"} 0.0
    django_model_inserts_total{model="choice"} 0.0

    Furthermore, the default dashboard relies on prometheus/django.rules to evaluate those formulas faster when asked.