PATH:
opt
/
hc_python
/
lib
/
python3.12
/
site-packages
/
sentry_sdk
/
integrations
from typing import TYPE_CHECKING from sentry_sdk.feature_flags import add_feature_flag from sentry_sdk.integrations import DidNotEnable, Integration try: import ldclient from ldclient.hook import Hook, Metadata if TYPE_CHECKING: from ldclient import LDClient from ldclient.hook import EvaluationSeriesContext from ldclient.evaluation import EvaluationDetail from typing import Any except ImportError: raise DidNotEnable("LaunchDarkly is not installed") class LaunchDarklyIntegration(Integration): identifier = "launchdarkly" def __init__(self, ld_client=None): # type: (LDClient | None) -> None """ :param client: An initialized LDClient instance. If a client is not provided, this integration will attempt to use the shared global instance. """ try: client = ld_client or ldclient.get() except Exception as exc: raise DidNotEnable("Error getting LaunchDarkly client. " + repr(exc)) if not client.is_initialized(): raise DidNotEnable("LaunchDarkly client is not initialized.") # Register the flag collection hook with the LD client. client.add_hook(LaunchDarklyHook()) @staticmethod def setup_once(): # type: () -> None pass class LaunchDarklyHook(Hook): @property def metadata(self): # type: () -> Metadata return Metadata(name="sentry-flag-auditor") def after_evaluation(self, series_context, data, detail): # type: (EvaluationSeriesContext, dict[Any, Any], EvaluationDetail) -> dict[Any, Any] if isinstance(detail.value, bool): add_feature_flag(series_context.key, detail.value) return data def before_evaluation(self, series_context, data): # type: (EvaluationSeriesContext, dict[Any, Any]) -> dict[Any, Any] return data # No-op.
[-] aws_lambda.py
[edit]
[+]
__pycache__
[-] chalice.py
[edit]
[-] anthropic.py
[edit]
[-] unleash.py
[edit]
[-] atexit.py
[edit]
[-] rq.py
[edit]
[-] gnu_backtrace.py
[edit]
[-] langgraph.py
[edit]
[+]
spark
[-] aiohttp.py
[edit]
[-] socket.py
[edit]
[-] sys_exit.py
[edit]
[-] boto3.py
[edit]
[-] sqlalchemy.py
[edit]
[-] asyncpg.py
[edit]
[-] openfeature.py
[edit]
[-] modules.py
[edit]
[-] executing.py
[edit]
[-] wsgi.py
[edit]
[-] dedupe.py
[edit]
[-] __init__.py
[edit]
[-] huey.py
[edit]
[-] fastapi.py
[edit]
[-] stdlib.py
[edit]
[-] cloud_resource_context.py
[edit]
[-] starlette.py
[edit]
[-] flask.py
[edit]
[-] bottle.py
[edit]
[-] starlite.py
[edit]
[-] rust_tracing.py
[edit]
[-] otlp.py
[edit]
[-] statsig.py
[edit]
[-] excepthook.py
[edit]
[-] ariadne.py
[edit]
[+]
pydantic_ai
[+]
..
[-] sanic.py
[edit]
[+]
google_genai
[+]
django
[+]
openai_agents
[-] dramatiq.py
[edit]
[-] langchain.py
[edit]
[-] graphene.py
[edit]
[-] loguru.py
[edit]
[-] clickhouse_driver.py
[edit]
[+]
celery
[-] tornado.py
[edit]
[-] strawberry.py
[edit]
[-] arq.py
[edit]
[-] litellm.py
[edit]
[-] openai.py
[edit]
[-] beam.py
[edit]
[-] launchdarkly.py
[edit]
[+]
grpc
[-] threading.py
[edit]
[+]
opentelemetry
[-] _wsgi_common.py
[edit]
[-] _asgi_common.py
[edit]
[-] argv.py
[edit]
[-] litestar.py
[edit]
[-] httpx.py
[edit]
[-] pymongo.py
[edit]
[-] mcp.py
[edit]
[-] cohere.py
[edit]
[-] pyramid.py
[edit]
[-] unraisablehook.py
[edit]
[-] quart.py
[edit]
[-] falcon.py
[edit]
[-] pure_eval.py
[edit]
[+]
redis
[-] logging.py
[edit]
[-] asgi.py
[edit]
[-] gql.py
[edit]
[-] gcp.py
[edit]
[-] ray.py
[edit]
[-] trytond.py
[edit]
[-] huggingface_hub.py
[edit]
[-] asyncio.py
[edit]
[-] typer.py
[edit]
[-] serverless.py
[edit]