|
14 | 14 | from fastapi.staticfiles import StaticFiles |
15 | 15 | from packaging.version import Version |
16 | 16 | from prometheus_client import Counter, Histogram |
17 | | -from sentry_sdk.types import SamplingContext |
18 | 17 |
|
19 | 18 | from dstack._internal import settings as core_settings |
20 | 19 | from dstack._internal.cli.utils.common import console |
@@ -115,7 +114,7 @@ async def lifespan(app: FastAPI): |
115 | 114 | release=core_settings.DSTACK_VERSION, |
116 | 115 | environment=settings.SERVER_ENVIRONMENT, |
117 | 116 | enable_tracing=True, |
118 | | - traces_sampler=_sentry_traces_sampler, |
| 117 | + traces_sampler=sentry_utils.sentry_traces_sampler, |
119 | 118 | profiles_sample_rate=settings.SENTRY_PROFILES_SAMPLE_RATE, |
120 | 119 | before_send=sentry_utils.AsyncioCancelledErrorFilterEventProcessor(), |
121 | 120 | ) |
@@ -426,18 +425,6 @@ def _is_prometheus_request(request: Request) -> bool: |
426 | 425 | return request.url.path.startswith("/metrics") |
427 | 426 |
|
428 | 427 |
|
429 | | -def _sentry_traces_sampler(sampling_context: SamplingContext) -> float: |
430 | | - parent_sampling_decision = sampling_context["parent_sampled"] |
431 | | - if parent_sampling_decision is not None: |
432 | | - return float(parent_sampling_decision) |
433 | | - transaction_context = sampling_context["transaction_context"] |
434 | | - name = transaction_context.get("name") |
435 | | - if name is not None: |
436 | | - if name.startswith("background."): |
437 | | - return settings.SENTRY_TRACES_BACKGROUND_SAMPLE_RATE |
438 | | - return settings.SENTRY_TRACES_SAMPLE_RATE |
439 | | - |
440 | | - |
441 | 428 | def _print_dstack_logo(): |
442 | 429 | console.print( |
443 | 430 | r"""[purple] _ _ _ |
|
0 commit comments