Socket
Socket
Sign inDemoInstall

sentry-dynamic-sampling-lib

Package Overview
Dependencies
4
Maintainers
2
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sentry-dynamic-sampling-lib

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


Maintainers
2

Readme

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

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc