0i&ddlZddlZddlmZddlZddlmZddlmZddl m Z ddl m Z ddl mZmZmZmZmZmZddlmZmZmZdd lmZmZmZdd lmZ dd lmZ dd l!m"Z"m#Z#dd l$m%Z%ddl'm(Z(e(r&ddl'm)Z)ddl'm*Z*ddl'm+Z+ddl'm,Z,ddl'm-Z-ddl.m/Z/m0Z0GddeZ1ejddZ3ee1dZ4dZ5GddeZ6y#e&$r edwxYw)N)iscoroutinefunction)continue_trace)OP)should_send_default_pii)TransactionSource)HAS_REAL_CONTEXTVARSCONTEXTVARS_ERROR_MESSAGEensure_integration_enabledevent_from_exceptioncapture_internal_exceptionstransaction_from_function)_check_minimum_version Integration DidNotEnable)RequestExtractor_filter_headers_is_json_content_type) ignore_logger) version_info)RequestHandler HTTPError) coroutinezTornado not installed) TYPE_CHECKING)Any)Optional)Dict)Callable) Generator)EventEventProcessorc*eZdZdZdeZedZy)TornadoIntegrationtornadoz auto.http.c.ttttst dt zt dtjt}|rfd}ntfd}|t_tjfd}|t_ y)NzUThe tornado integration for Sentry requires Python 3.7+ or the aiocontextvars packageztornado.accessczKt|5|g|i|d{cdddS7 #1swYyxYwwN_handle_request_impl)selfargskwargs old_executes N/opt/hc_python/lib/python3.12/site-packages/sentry_sdk/integrations/tornado.pysentry_execute_request_handlerzETornadoIntegration.setup_once..sentry_execute_request_handlerGs8)$/!,T!CD!CF!CC0/C0/s ;/-/ ;/8;c?~Kt|5|g|i|Ed{}|cdddS7#1swYyxYwwr&r')r)r*r+resultr,s r-r.zETornadoIntegration.setup_once..sentry_execute_request_handlerNs?*$/(3D(J4(J6(JJF!0/J0/s =1/1 =1:=c<t|||||||g|i|Sr&)_capture_exception)r)tyvaluetbr*r+old_log_exceptions r-sentry_log_exceptionz;TornadoIntegration.setup_once..sentry_log_exceptionYs* r5" -$T2ubJ4J6J J) rr"TORNADO_VERSIONrrr rr_executerr log_exception) awaitabler.r7r,r6s @@r- setup_oncezTornadoIntegration.setup_once1s 1?C#g+,  &'$-- ' 4  D " " #A*88 K (<$r8N)__name__ __module__ __qualname__ identifierorigin staticmethodr=r8r-r"r"-s%J* &F,<,D D'D DD$ D'ct|tryt|||ftjj ddd\}}tj ||y)Nr#F)typehandled)client_options mechanism)hint) isinstancerr rKrLoptions capture_event)r3r4r5eventrcs r-r2r2sT%#& UB!,,.66$7KE4 U.r8cfd}|S)NcD}||S|j}t5t||jjj }t |xsd|d<dt ji|d<dddt5t|}|j||d}|jd|j|j|d<|j|d<|j|d <d |ji|d <tt!|j"|d <dddt5|j$r,t'r"|j)d ij)ddddd|S#1swYxYw#1swYcxYw#1swY|SxYw)Nr]rHtransaction_inforQz://url query_stringmethod REMOTE_ADDRenvrRuseris_authenticatedT)rQr getattrrnlowerr r COMPONENTTornadoRequestExtractorextract_into_eventprotocolhostpathquery remote_iprdictrR current_userr setdefault)rgrchandlerrQrn extractor request_inforZs r-tornado_processorz0_make_event_processor..tornado_processorsq. ?L// ( *Wgoo&<&<&B&B&DEF#D$>DAq!1Q4$>DDDs ??c4t|jxsdS)NrD)rr)r)files r- size_of_filez$TornadoRequestExtractor.size_of_files499?##r8N) r>r?r@rrrrrrrrDr8r-rvrvs(& E! OE$r8rv)7rN contextlibinspectrrKsentry_sdk.apirsentry_sdk.constsrsentry_sdk.scopersentry_sdk.tracingrsentry_sdk.utilsrr r r r r sentry_sdk.integrationsrrr$sentry_sdk.integrations._wsgi_commonrrrsentry_sdk.integrations.loggingrr#rr9 tornado.webrr tornado.genr ImportErrortypingrrrrrrsentry_sdk._typesrr r"contextmanagerr(r2rTrvrDr8r-rs') 40VU :075%! 71<1