|
1 | | -from contextlib import asynccontextmanager |
2 | 1 | from random import Random |
3 | | -from typing import Callable, TYPE_CHECKING |
| 2 | +from typing import TYPE_CHECKING, Callable |
| 3 | +from contextlib import asynccontextmanager |
4 | 4 |
|
5 | 5 | import sentry_sdk |
| 6 | +from fastapi_jsonrpc import BaseError, Entrypoint, JsonRpcContext |
| 7 | +from sentry_sdk.utils import event_from_exception, is_valid_sample_rate |
6 | 8 | from sentry_sdk.consts import OP |
7 | 9 | from sentry_sdk.tracing import SENTRY_TRACE_HEADER_NAME, Transaction |
8 | 10 | from sentry_sdk.tracing_utils import normalize_incoming_data |
9 | | -from sentry_sdk.utils import event_from_exception, is_valid_sample_rate |
10 | 11 |
|
11 | | -from fastapi_jsonrpc import JsonRpcContext, BaseError, Entrypoint |
12 | 12 | from .http import sentry_asgi_context |
13 | 13 |
|
14 | 14 | if TYPE_CHECKING: |
@@ -51,18 +51,16 @@ async def jrpc_transaction_middleware(ctx: JsonRpcContext): |
51 | 51 | **transaction_params, # type: ignore |
52 | 52 | ) |
53 | 53 |
|
54 | | - integration: FastApiJsonRPCIntegration | None = sentry_sdk.get_client().get_integration( |
| 54 | + integration: FastApiJsonRPCIntegration | None = sentry_sdk.get_client().get_integration( # type: ignore |
55 | 55 | "FastApiJsonRPCIntegration" |
56 | 56 | ) |
57 | 57 | name_generator = integration.transaction_name_generator if integration else default_transaction_name_generator |
58 | 58 |
|
59 | 59 | with jrpc_request_scope.start_transaction( |
60 | | - transaction, |
61 | | - scope=jrpc_request_scope, |
| 60 | + transaction, |
| 61 | + scope=jrpc_request_scope, |
62 | 62 | ): |
63 | | - jrpc_request_scope.add_event_processor( |
64 | | - make_transaction_info_event_processor(ctx, name_generator) |
65 | | - ) |
| 63 | + jrpc_request_scope.add_event_processor(make_transaction_info_event_processor(ctx, name_generator)) |
66 | 64 | try: |
67 | 65 | yield |
68 | 66 | except Exception as exc: |
|
0 commit comments