o
    S۷i                     @   s   d dl Z d dlmZ d dlmZ d dlmZmZ d dlmZ zd dl	m
Z
 d dlmZ W n ey7   edw G d	d
 d
eZdS )    N)Integration)SentryWsgiMiddleware)ensure_integration_enabledevent_from_exception)DidNotEnable)TrytonException)appzTrytond is not installed.c                   @   s2   e Zd ZdZde Zd	ddZed	ddZdS )
TrytondWSGIIntegrationtrytond_wsgiz
auto.http.returnNc                 C   s   d S N )selfr   r   U/home/ubuntu/vllm_env/lib/python3.10/site-packages/sentry_sdk/integrations/trytond.py__init__   s   zTrytondWSGIIntegration.__init__c                     s\   t tjtjdt_ttdtdd fdd ttdr&tj fdd} d S tj	
  d S )	N)span_originer   c                 S   sB   t | trd S t }t| |jdddd\}}tj||d d S )NtrytondF)typehandled)client_options	mechanism)hint)
isinstancer   
sentry_sdk
get_clientr   optionscapture_event)r   clienteventr   r   r   r   error_handler   s   

z8TrytondWSGIIntegration.setup_once.<locals>.error_handlerr    c                    s    | d S r   r   )r   requestr   r    r   r   _0   s   z,TrytondWSGIIntegration.setup_once.<locals>._)r   r   wsgi_appr	   originr   	Exceptionhasattrr    error_handlersappend)r#   r   r"   r   
setup_once   s   
z!TrytondWSGIIntegration.setup_once)r   N)__name__
__module____qualname__
identifierr%   r   staticmethodr*   r   r   r   r   r	      s    

r	   )r   sentry_sdk.integrationsr   sentry_sdk.integrations.wsgir   sentry_sdk.utilsr   r   r   trytond.exceptionsr   trytond.wsgir   ImportErrorr	   r   r   r   r   <module>   s    