Skip to main content

A Django+Djangae app to collect session and access metrics.

Project description

This package installs models and middleware used to simplify user tracking across sessions and correlate access to resources to the user requesting such access.

Some of the tools in this project assume you are running in a non-relational environment (so far only Google App Engine is supported) for your views of interest. As such, the project depends on the djangae package. Some day perhaps I will split this into relational and non-relational sub-packages.

Quick start

The easiest way to use django-autometrics-nonrel is to use the RestFrameworkGenericViewSetAutoMetricsMixin to provide built-in recording of user retrieval of entities:

Add the project to your INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'autometrics_nonrel',
    ...
]

Add the middleware to MIDDLEWARE_CLASSES anywhere after SessionMiddleware:

MIDDLEWARE_CLASSES = (
    ...
    'django.contrib.sessions.middleware.SessionMiddleware',
    'autometrics_nonrel.middleware.UserSessionTrackingMiddleware',
    ...
)

Use the mixin on your Django REST Framework GenericViewSet (or any viewset derived from GenericViewSet) to automatically log user access to items:

from rest_framework import viewsets
from autometrics_nonrel import mixins
from myapp.models import MyModel
class MyViewSet(
        viewsets.ReadOnlyModelViewSet,
        RestFrameworkGenericViewSetAutoMetricsMixin
):
    model = MyModel
    queryset = MyModel.objects.all()
    ...

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-autometrics-nonrel-1.0.0.tar.gz (9.1 kB view details)

Uploaded Source

File details

Details for the file django-autometrics-nonrel-1.0.0.tar.gz.

File metadata

File hashes

Hashes for django-autometrics-nonrel-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cb3bb80fd90b6a69eef8d56ddaf6e8d7675cc6d49d3c8ce764af195624547454
MD5 2a498a4b056dcea3e7048d60d3ee2d61
BLAKE2b-256 0ff21dcd53258dfda4106babe0e152ab6cb5050c34f16381480b4fbabd580806

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