Skip to main content

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

Metadata

Release files for sentry-dynamic-sampling-lib 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sentry-dynamic-sampling-lib 1.2.0
File Size Uploaded
sentry_dynamic_sampling_lib-1.2.0.tar.gz 7.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sentry-dynamic-sampling-lib 1.2.0
File Interpreter ABI Platform
sentry_dynamic_sampling_lib-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / sentry_dynamic_sampling_lib-1.2.0.tar.gz

Download URL sentry_dynamic_sampling_lib-1.2.0.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e438081f29301e9ed2598d9d5317625d34d6c4814f8f14d737460815c8dc1b40
BLAKE2b-256 checksum
How to use checksums
43c47118feabc6216a276d7c90becb97e453759f2db08ffd3e69160781c2729f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.9.16 Linux/5.15.0-1037-azure

Release files / sentry_dynamic_sampling_lib-1.2.0-py3-none-any.whl

Download URL sentry_dynamic_sampling_lib-1.2.0-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06876bed273e8892e97f7c6fd8feb47195c7ea041bb3941916cd19bee10f9486
BLAKE2b-256 checksum
How to use checksums
573ae0d05c8e90f43f69ab4dd375be8f4063f1a0c242e04adc135b8192b9b62e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.9.16 Linux/5.15.0-1037-azure
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page