Skip to main content

This project aims to provide dynamic sampling without relying on Sentry Dynamic Sampling.

Project description

Sentry Dynamic Sampling Controller

PyPI Tests Status codecov PyPI - Python Version PyPI - License


This project aims to provide dynamic sampling without relying on Sentry own's Dynamic Sampling. This libs works by adding a traces_sampler callback to sentry. In the background a thread fetch the data from the controller It's also able to ignore WSGI route an Celery task set in controller.

Usage

import sentry_sdk
from sentry_dynamic_sampling_lib import init_wrapper

# init sentry as usual
# without traces_sampler and sample_rate param
sentry_sdk.init(  # pylint: disable=E0110
    dsn=SENTRY_DSN,
    integrations=[],
    environment=ENVIRONMENT,
    release=SENTRY_RELEASE,
)

# hook sentry_dynamic_sampling_lib into sentry
init_wrapper()

Configuration

The following environment variables can be used to configure the lib

SENTRY_CONTROLLER_HOST=none # (required, no default)
SENTRY_CONTROLLER_PATH="/sentry/apps/{}/" # (optional, default to example)
SENTRY_CONTROLLER_METRIC_PATH="/sentry/apps/{}/metrics/{}/" # (optional, default to example)
SENTRY_CONTROLLER_POLL_INTERVAL=60 # (optional, default to example)
SENTRY_CONTROLLER_METRIC_INTERVAL=600 # (optional, default to example)

Development

# install deps
poetry install

# pre-commit
poetry run pre-commit install --install-hook
poetry run pre-commit install --install-hooks --hook-type commit-msg

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

sentry_dynamic_sampling_lib-1.2.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file sentry_dynamic_sampling_lib-1.2.0.tar.gz.

File metadata

  • Download URL: sentry_dynamic_sampling_lib-1.2.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.9.16 Linux/5.15.0-1037-azure

File hashes

Hashes for sentry_dynamic_sampling_lib-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e438081f29301e9ed2598d9d5317625d34d6c4814f8f14d737460815c8dc1b40
MD5 7de9908e129d031d3e94a2b81ac8576b
BLAKE2b-256 43c47118feabc6216a276d7c90becb97e453759f2db08ffd3e69160781c2729f

See more details on using hashes here.

File details

Details for the file sentry_dynamic_sampling_lib-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sentry_dynamic_sampling_lib-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06876bed273e8892e97f7c6fd8feb47195c7ea041bb3941916cd19bee10f9486
MD5 f2f925b07a7d503d6486c2c563762519
BLAKE2b-256 573ae0d05c8e90f43f69ab4dd375be8f4063f1a0c242e04adc135b8192b9b62e

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