Skip to main content

Django management command statistics

Project description

Installation

$ pip install django-command-stat

How it works

collected statistics:

  • calls count
  • errors count
  • cpu time
  • memory
  • started, finished time

implementations:

  • StatCommand management command class
  • @command_stat decorator

settings.py

INSTALLED_APPS+=['django_command_stat']

migrate

$ python manage.py migrate

Examples

StatCommand

from django_command_stat.management.base import StatCommand

class Command(StatCommand):
    def handle(self,*args,**options):
        # your code

@command_stat decorator

from django_command_stat.decorators import command_stat

class Command(BaseCommand):
    @command_stat
    def handle(self,*args,**kwargs):
        ...
class BaseCommand(BaseCommand):
    def execute(self,*args,**kwargs):
        return command_stat(self.handle)(self,*args,**kwargs)
from django.core.management import call_command

command_stat(call_command)(name,*args,**options)

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-command-stat-2021.6.21.tar.gz (5.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page