cronitor
Advanced tools
| Metadata-Version: 2.1 | ||
| Name: cronitor | ||
| Version: 4.6.0 | ||
| Version: 4.7.0 | ||
| Summary: A lightweight Python client for Cronitor. | ||
@@ -57,3 +57,3 @@ Home-page: https://github.com/cronitorio/cronitor-python | ||
| # Discover all of your celery tasks and automatically add monitoring. | ||
| # Discover all of your celery tasks and automatically add monitoring. | ||
| cronitor.celery.initialize(app, api_key="apiKey123") | ||
@@ -88,3 +88,3 @@ | ||
| # If no monitor matches the provided key, one will be created automatically. | ||
| @cronitor.job('send-invoices') | ||
| @cronitor.job('send-invoices') | ||
| def send_invoices_task(*args, **kwargs): | ||
@@ -104,2 +104,5 @@ ... | ||
| # optionally, set an environment | ||
| cronitor.environment = 'staging' | ||
| monitor = cronitor.Monitor('heartbeat-monitor') | ||
@@ -112,3 +115,2 @@ monitor.ping() # send a heartbeat event | ||
| state='run|complete|fail|ok', # run|complete|fail used to measure lifecycle of a job, ok used for manual reset only. | ||
| env='', # the environment this is running in (e.g. staging, production) | ||
| message='', # message that will be displayed in alerts as well as monitor activity panel on your dashboard. | ||
@@ -144,3 +146,11 @@ metrics={ | ||
| The timeout value for validate_config, apply_config and generate_config is 10 seconds by default. The value can be rewritten by setting the environment variable `CRONITOR_TIMEOUT`. It can also be rewritten by assigning a value to cronitor.timeout. | ||
| ```python | ||
| import cronitor | ||
| cronitor.timeout = 30 | ||
| cronitor.apply_config() | ||
| ``` | ||
| The `cronitor.yaml` file includes three top level keys `jobs`, `checks`, `heartbeats`. You can configure monitors under each key by defining [monitors](https://cronitor.io/docs/monitor-api#attributes). | ||
@@ -147,0 +157,0 @@ |
@@ -20,2 +20,6 @@ import logging | ||
| config = os.getenv('CRONITOR_CONFIG', None) | ||
| timeout = os.getenv('CRONITOR_TIMEOUT', None) | ||
| if timeout is not None: | ||
| timeout = int(timeout) | ||
| celerybeat_only = False | ||
@@ -22,0 +26,0 @@ |
@@ -42,2 +42,3 @@ import time | ||
| def as_yaml(cls, api_key=None, api_version=None): | ||
| timeout = cronitor.timeout or 10 | ||
| api_key = api_key or cronitor.api_key | ||
@@ -47,3 +48,3 @@ resp = cls._req.get('%s.yaml' % cls._monitor_api_url(), | ||
| headers=dict(cls._headers, **{'Content-Type': 'application/yaml', 'Cronitor-Version': api_version}), | ||
| timeout=10) | ||
| timeout=timeout) | ||
| if resp.status_code == 200: | ||
@@ -92,2 +93,3 @@ return resp.text | ||
| def _put(cls, monitors, api_key, rollback, request_format, api_version): | ||
| timeout = cronitor.timeout or 10 | ||
| payload = _prepare_payload(monitors, rollback, request_format) | ||
@@ -107,3 +109,3 @@ if request_format == YAML: | ||
| headers=dict(cls._headers, **{'Content-Type': content_type, 'Cronitor-Version': api_version}), | ||
| timeout=10) | ||
| timeout=timeout) | ||
@@ -110,0 +112,0 @@ if resp.status_code == 200: |
@@ -12,2 +12,3 @@ import yaml | ||
| cronitor.api_key = FAKE_API_KEY | ||
| cronitor.timeout = 10 | ||
@@ -14,0 +15,0 @@ with open(YAML_PATH, 'r') as conf: |
+14
-4
| Metadata-Version: 2.1 | ||
| Name: cronitor | ||
| Version: 4.6.0 | ||
| Version: 4.7.0 | ||
| Summary: A lightweight Python client for Cronitor. | ||
@@ -57,3 +57,3 @@ Home-page: https://github.com/cronitorio/cronitor-python | ||
| # Discover all of your celery tasks and automatically add monitoring. | ||
| # Discover all of your celery tasks and automatically add monitoring. | ||
| cronitor.celery.initialize(app, api_key="apiKey123") | ||
@@ -88,3 +88,3 @@ | ||
| # If no monitor matches the provided key, one will be created automatically. | ||
| @cronitor.job('send-invoices') | ||
| @cronitor.job('send-invoices') | ||
| def send_invoices_task(*args, **kwargs): | ||
@@ -104,2 +104,5 @@ ... | ||
| # optionally, set an environment | ||
| cronitor.environment = 'staging' | ||
| monitor = cronitor.Monitor('heartbeat-monitor') | ||
@@ -112,3 +115,2 @@ monitor.ping() # send a heartbeat event | ||
| state='run|complete|fail|ok', # run|complete|fail used to measure lifecycle of a job, ok used for manual reset only. | ||
| env='', # the environment this is running in (e.g. staging, production) | ||
| message='', # message that will be displayed in alerts as well as monitor activity panel on your dashboard. | ||
@@ -144,3 +146,11 @@ metrics={ | ||
| The timeout value for validate_config, apply_config and generate_config is 10 seconds by default. The value can be rewritten by setting the environment variable `CRONITOR_TIMEOUT`. It can also be rewritten by assigning a value to cronitor.timeout. | ||
| ```python | ||
| import cronitor | ||
| cronitor.timeout = 30 | ||
| cronitor.apply_config() | ||
| ``` | ||
| The `cronitor.yaml` file includes three top level keys `jobs`, `checks`, `heartbeats`. You can configure monitors under each key by defining [monitors](https://cronitor.io/docs/monitor-api#attributes). | ||
@@ -147,0 +157,0 @@ |
+13
-3
@@ -49,3 +49,3 @@ # Cronitor Python Library | ||
| # Discover all of your celery tasks and automatically add monitoring. | ||
| # Discover all of your celery tasks and automatically add monitoring. | ||
| cronitor.celery.initialize(app, api_key="apiKey123") | ||
@@ -80,3 +80,3 @@ | ||
| # If no monitor matches the provided key, one will be created automatically. | ||
| @cronitor.job('send-invoices') | ||
| @cronitor.job('send-invoices') | ||
| def send_invoices_task(*args, **kwargs): | ||
@@ -96,2 +96,5 @@ ... | ||
| # optionally, set an environment | ||
| cronitor.environment = 'staging' | ||
| monitor = cronitor.Monitor('heartbeat-monitor') | ||
@@ -104,3 +107,2 @@ monitor.ping() # send a heartbeat event | ||
| state='run|complete|fail|ok', # run|complete|fail used to measure lifecycle of a job, ok used for manual reset only. | ||
| env='', # the environment this is running in (e.g. staging, production) | ||
| message='', # message that will be displayed in alerts as well as monitor activity panel on your dashboard. | ||
@@ -136,3 +138,11 @@ metrics={ | ||
| The timeout value for validate_config, apply_config and generate_config is 10 seconds by default. The value can be rewritten by setting the environment variable `CRONITOR_TIMEOUT`. It can also be rewritten by assigning a value to cronitor.timeout. | ||
| ```python | ||
| import cronitor | ||
| cronitor.timeout = 30 | ||
| cronitor.apply_config() | ||
| ``` | ||
| The `cronitor.yaml` file includes three top level keys `jobs`, `checks`, `heartbeats`. You can configure monitors under each key by defining [monitors](https://cronitor.io/docs/monitor-api#attributes). | ||
@@ -139,0 +149,0 @@ |
+1
-1
@@ -8,3 +8,3 @@ from setuptools import setup, find_packages | ||
| name='cronitor', | ||
| version='4.6.0', | ||
| version='4.7.0', | ||
| packages=find_packages(), | ||
@@ -11,0 +11,0 @@ url='https://github.com/cronitorio/cronitor-python', |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
67257
2%695
0.87%