django_auto_healthchecks¶
Module contents¶
-
class
django_auto_healthchecks.
Healthcheck
(route=None, args=None, kwargs=None, current_app=None, name=None, key=None, method=u'GET', querystring=None, body=None, headers=None, cookies=None, assertions=None, tags=None, note=None, interval_seconds=None, timeout_seconds=None)[source]¶ Bases:
object
:type healthchecks.Healthcheck
-
exception
django_auto_healthchecks.
HealthcheckError
[source]¶ Bases:
exceptions.RuntimeError
:type healthchecks.HealthcheckError Healthcheck definition exception
django_auto_healthchecks.healthchecks module¶
-
class
django_auto_healthchecks.healthchecks.
Healthcheck
(route=None, args=None, kwargs=None, current_app=None, name=None, key=None, method=u'GET', querystring=None, body=None, headers=None, cookies=None, assertions=None, tags=None, note=None, interval_seconds=None, timeout_seconds=None)[source]¶ Bases:
object
Define a healthcheck using a django url route that will be put to the Cronitor API
route (str): Name of a url route. If omitted, must be set before resolve().
args (list|tuple): Optional args to be passed to reverse() this route. Cannot be used with kwargs.
kwargs (dict): Optional kwargs to be passed to reverse() this route. Cannot be used with args.
- current_app (str): If the app is namespaced or route name is not unique the current_app argument is
- needed for reverse().
name (str): Optional name for this monitor. If none is provided, a name will be generated.
key (str): Optional monitor key. Use this to tie to an existing healthcheck.
method (str): Request method used when performing this healthcheck.
querystring (dict): Optional querystring parameters that will be appended to the URL
body (str): Request body sent when performing this healthcheck if method is PUT, POST or PATCH.
headers (dict): Optional request headers that will be sent when performing this healthcheck.
cookies (dict): Optional cookies that will be sent when performing this healthcheck.
assertions (dict): Optional assertions for this monitor. See API docs for details.
tags (list|tuple): Optional tags for this monitor.
note (string): Optional note that will be attached to this monitor.
interval_seconds (int): Optional interval between healthcheck tests. If omitted, a default will be used.
timeout_seconds (int): Optional timeout for this request, maximum of 10 seconds.
-
exception
django_auto_healthchecks.healthchecks.
HealthcheckError
[source]¶ Bases:
exceptions.RuntimeError
-
class
django_auto_healthchecks.healthchecks.
HealthcheckUrl
(path, querystring)[source]¶ Bases:
object
-
display
= None¶ :type unicode Shorter, prettier version of URL for display
-
url
= None¶ :type unicode Fully qualified URL that will be used in healthcheck
-
-
class
django_auto_healthchecks.healthchecks.
IdempotentHealthcheckClient
[source]¶ Bases:
object
Put enqueued healthchecks to the Cronitor API.
-
drain
()[source]¶ Drain enqueued healthchecks and return a list of distinct Healthcheck objects :return: List[Healthcheck]
-
-
django_auto_healthchecks.healthchecks.
put
(healthchecks=())[source]¶ Batch create-or-update health checks with supplied list of Healthcheck instances. Invoke from your deploy script, or add healthchecks for third-party apps without having to hack their code. :param healthchecks: list[Healthcheck] of Healthcheck objects These healthchecks will be merged with any defined in
urls.py file(s). See https://cronitor.io/docs/django-health-checks for details.
-
django_auto_healthchecks.healthchecks.
url
(regex, view, healthcheck=None, **kwargs)[source]¶ Drop-in replacement for django.conf.urls.url to create and update a Cronitor healthcheck when your app restarts. See https://cronitor.io/docs/django-health-checks for details. regex (str): Route regex, passed to django.conf.urls.url() view (mixed): Attached view for this route, passed to django.conf.urls.url() healthcheck (Healthcheck): Define your healthcheck with a Healthcheck() instance. :return RegexURLPattern