Skip to main content

No project description provided

Project description

A Django application that exposes a bunch of PostgreSQL database metrics.

Background

At PyCon Canada 2017 Craig Kerstiens gave a talk “Postgres at any scale”. In his talk Craig pointed out a bunch of metrics one should look at to understand why a PostgreSQL database could be “slow” or not perform as expected.

This project adds a Django Admin view exposing these metrics to Django users with the is_superusers flag turned on.

Installation

Start by installing django-postgres-metrics from PyPI:

$ pip install django-postgres-metrics

You will also need to make sure to have psycopg2 or psycopg2-binary installed which is already a requirement by Django for PostgreSQL support anyway.

Then you need to add postgres_metrics to your INSTALLED_APPS list. Due to the wait postgres_metrics works, you need to include it before the admin app:

INSTALLED_APPS = [
    'postgres_metrics.apps.PostgresMetrics',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

Lastly, you need to add a URL path to your global urls.py before the admin URL patterns.

For Django 2.0 and up:

from django.urls import include, path
urlpatterns = [
    path('admin/postgres-metrics/', include('postgres_metrics.urls')),
    path('admin/', admin.site.urls),
]

For Django 1.11 and before:

from django.conf.urls import include, url
urlpatterns = [
    url(r'^admin/postgres-metrics/', include('postgres_metrics.urls')),
    url(r'^admin/', admin.site.urls),
]

Security

If you found or if you think you found a security issue please get in touch via info+django-postgres-stats *AT* markusholtermann *DOT* eu.

I’m working about this in my free time. I don’t have time to monitor the email 24/7. But you should normally receive a response within a week. If I haven’t got back to you within 2 weeks, please reach out again.

TESTING

To run the unit tests:

$ pip install tox
$ tox

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-postgres-metrics-0.6.1.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

django_postgres_metrics-0.6.1-py2.py3-none-any.whl (16.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-postgres-metrics-0.6.1.tar.gz.

File metadata

File hashes

Hashes for django-postgres-metrics-0.6.1.tar.gz
Algorithm Hash digest
SHA256 1d2ba0ef68537ca8b1be3d5a7dfe7e1e4a91e5a965bb23d7da76c9628e3635ca
MD5 adb4d82411e284be76d5a3d70dfbd4f1
BLAKE2b-256 b63bb6882c6ae8382284364a4a98c04e445e063fa2c4569fb19845a19887eee5

See more details on using hashes here.

File details

Details for the file django_postgres_metrics-0.6.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_postgres_metrics-0.6.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f9022ff6866b56e647a09186c6e1bea51fbca1296eba4538b060af90d42942a3
MD5 4f47b6d350eeed7a7807d9feb6715f80
BLAKE2b-256 b5b2ab0952a8459a9beecf750b77c423591a879167e54959249d7d060ad0b56f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page