Skip to main content

MBQ Ranch

Project description

Ranch

Standardized tooling, monitoring, and retry logic for use with Celery

Installation

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

INSTALLED_APPS = [
    ...
    'mbq.ranch'
]

RANCH = {
    'env': ENV_NAME,  # e.g. production, development
    'service': MY_SERVICE_NAME,  # e.g. os-core
}

Features

Metrics

Any application with Ranch installed will have Celery metrics available in the Celery/Ranch DataDog Dashboard.

Monitors

TODO: Include link to Invoice's monitors once they're built

You may set up monitors for your application using the metrics provided by Ranch. To get started, you might want to copy Invoicing's monitors.

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 OS Core's Ranch Admin 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:

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. This is used in OS Core to tag each error as belonging to a specific team.

To use this feature, add the following settings:

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"
    # See OS Core's usage for an example
    'extra_error_queue_tags_fn': tags_fn,
}

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

mbq.ranch-2.1.0.tar.gz (13.8 kB view details)

Uploaded Source

File details

Details for the file mbq.ranch-2.1.0.tar.gz.

File metadata

  • Download URL: mbq.ranch-2.1.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7

File hashes

Hashes for mbq.ranch-2.1.0.tar.gz
Algorithm Hash digest
SHA256 14a2c9f15fc1cf2a511763847f95160aca1bb5f05221e9be256f0f51058a3f1a
MD5 26d46ea77cedfa21f10ff9129602d72a
BLAKE2b-256 9600d564663ae63195d684b5393272a8c05413b50fdcf345ea93c95309178211

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