Metadata-Version: 2.4
Name: csv.ranch
Version: 1.0
Summary: CSF Ranch
Home-page: https://github.com/Constrafor/csf.ranch/
Author: Evan
Author-email: evan.mce;heny@constrafor.com
Maintainer: Evan
Maintainer-email: evan.mce;heny@constrafor.com
License: Apache 2.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Libraries
Description-Content-Type: text/markdown
Requires-Dist: arrow
Requires-Dist: celery<5.0
Requires-Dist: mbq.env<3,>=2
Requires-Dist: mbq.metrics<2,>=1
Requires-Dist: rollbar
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: maintainer
Dynamic: maintainer-email
Dynamic: requires-dist
Dynamic: summary

Ranch
=====

Standardized tooling, monitoring, and retry logic for use with Celery. fork of https://github.com/managedbyq/mbq.ranch

## Installation

Ranch is a Django application. To use Ranch with Celery, add the following to your settings file:

```python
INSTALLED_APPS = [
    ...
    'csf.ranch'
]

RANCH = {
    'env': ENV_NAME,  # e.g. production, development
    'service': MY_SERVICE_NAME,  # e.g. backend
}
```

## Features

### Metrics

Any application with Ranch installed will have Celery metrics available in [the Celery/Ranch Datadog Dashboard](https://app.datadoghq.com/dashboard/hre-8ng-ywv/celery).

### Monitors
You may set up monitors for your application using the metrics provided by Ranch.

### Dead Letter Queue

Celery jobs that fail will be stored in the application's database for inspection and reprocessing. Ranch provides an Admin interface for this.

See [backends's Ranch Admin](https://api.constrafor.com/constrafor-admin/ranch/loggedtask/) for an example.

### Correlation IDs

Ranch can flow correlation IDs through your Celery jobs. Ranch will *not* change any of your logging configuration, so you'll still need to do that as part of your correlation ID implementation.

To use the correlation ID functionality, add the following settings:

```python
RANCH = {
    ...,
    'correlation': {
        'getter': getter_fn,  # callable with no args that returns the current correlation ID
        'setter': setter_fn,  # callable with one arg which should be set as the current correlation ID
    },
}
```

### Supplemental Error Tagging

Ranch provides a hook to add additional tagging information to error item metrics.

To use this feature, add the following settings:

```python
RANCH = {
    ...,
    # tags_fn takes a single arg (the Ranch Task object that failed)
    # and should return a list of strings in the format "tag_name:tag_value"
    'extra_error_queue_tags_fn': tags_fn,
}
```
