
    yj
                        d Z ddlmZ ddlZddlZddlmZmZ ddlm	Z	 ddl
mZmZmZmZ ddlZddlmZ  ed          Z ed	          Zerdd
lmZ ddlmZ  ej        e          ZddddZddZdS )z(Sentry initialization and configuration.    )annotationsN)CallableSequence)wraps)TYPE_CHECKING	ParamSpecTypeVarcast)settingsPT)EventProcessor)Integration)before_sendintegrationsSequence[Integration]r   EventProcessor | NonereturnNonec           
         t          j        t          j        j        dt          j        j        t          j        j        t          j        j        t          j        j        ||            dS )zInitialize Sentry SDK with project settings.

    Args:
        integrations: Sentry SDK integrations to enable (e.g., Starlette, FastAPI).
        before_send: Optional event filter callback to suppress specific exceptions.
    T)dsnenable_tracingreleaseenvironmenttraces_sample_rateprofiles_sample_rater   r   N)	
sentry_sdkinitr   SENTRYDSNRELEASEENVIRONMENTTRACES_SAMPLE_RATEPROFILES_SAMPLE_RATE)r   r   s     </DATA/AppData/hermes/projects/honcho/src/telemetry/sentry.pyinitialize_sentryr&      sX     OO'O/#?=%_A!	 	 	 	 	 	    namestrop*Callable[[Callable[P, T]], Callable[P, T]]c                     d fd}|S )a  Decorator to wrap a function in a Sentry transaction.

    Args:
        name: The name of the transaction.
        op: The operation type (e.g., "deriver", "http.server").

    Returns:
        A decorator that wraps the target function in a Sentry transaction.

    Example:
        @with_sentry_transaction("process_task", op="deriver")
        def process_task(data):
            ...
    funcCallable[P, T]r   c                     t          j                   rDt                     d	 fd            }t          t          t
          t          f         |          S t                     d	 fd            }|S )
NargsP.argskwargsP.kwargsr   r   c                    K   t          j                  5   | i | d {V cd d d            S # 1 swxY w Y   d S N)r(   r*   r   start_transactionr0   r2   r-   r(   r*   s     r%   async_wrapperzAwith_sentry_transaction.<locals>.decorator.<locals>.async_wrapperK   s      1tCCC 7 7!%t!6v!6!66666667 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7s   599c                 t    t          j                  5   | i |cd d d            S # 1 swxY w Y   d S r5   r6   r8   s     r%   sync_wrapperz@with_sentry_transaction.<locals>.decorator.<locals>.sync_wrapperS   s    1tCCC 1 140001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1s   -11)r0   r1   r2   r3   r   r   )inspectiscoroutinefunctionr   r
   r   r   r   )r-   r9   r;   r(   r*   s   `  r%   	decoratorz*with_sentry_transaction.<locals>.decoratorH   s    &t,, 	 4[[7 7 7 7 7 7 7 [7 A666 4[[1 1 1 1 1 1 1 [1  r'   )r-   r.   r   r.    )r(   r*   r>   s   `` r%   with_sentry_transactionr@   6   s/    $             $ r'   )r   r   r   r   r   r   )r(   r)   r*   r)   r   r+   )__doc__
__future__r   r<   loggingcollections.abcr   r   	functoolsr   typingr   r   r	   r
   r   
src.configr   r   r   sentry_sdk._typesr   sentry_sdk.integrationsr   	getLogger__name__loggerr&   r@   r?   r'   r%   <module>rM      s4   . . " " " " " "   . . . . . . . .       : : : : : : : : : : : :          IcNNGCLL 4000000333333		8	$	$ *.     .$ $ $ $ $ $r'   