
    g                         d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
Z
d dlmZ d dlmZ erd d	lmZ d d
l mZmZ  G d de      Zy)    )MYPY)Hub)Integrationadd_global_event_processor)DsnN)DEFAULT_HOST)POSTHOG_ID_TAG)Optional)EventHintc                   ,    e Zd ZdZdZdZdZed        Zy)PostHogIntegrationzposthog-pythonNz https://sentry.io/organizations/c                      t         d        } y )Nc                    t         j                  j                  t              >| j	                  d      dk7  r| S | j	                  di       j	                  t
              r| d   t
           }t        j                  xs t         d| | d   d<   | d   | d   d}t        j                  rt        j                  xs_ t         j                  j                  j                    xr7 t        t         j                  j                  j                        j                  }|r.t        j                   t        j                   d	| d
| d    |d<   t        j                  |d|       | S )Nlevelerrortagsz/person/zPostHog URLevent_id	exception)z$sentry_event_idz$sentry_exceptionz/issues/?project=z&query=z$sentry_urlz
$exception)r   currentget_integrationr   getr
   posthoghostr	   organization
project_idclientdsnr   prefixcapture)eventhintposthog_distinct_id
propertiesr   s        W/var/www/openai/venv/lib/python3.12/site-packages/posthog/sentry/posthog_integration.py	processorz0PostHogIntegration.setup_once.<locals>.processor   s_    {{**+=>J99W%0 L99VR(,,^<*/-*G'6=ll6Rl5SS[\o[p3qE&M-0 -2*,=-2;-?"J
 *66%7%B%B &$'KK$6$6$:$: ::es3;;CUCUCYCY?Z?e?e # &#5#<#<"=>P>]>]=^^opzo{  |C  DI  JT  DU  CV  !W '}5 OO$7zRL    r   )r'   s    r&   
setup_oncezPostHogIntegration.setup_once   s    	#	 
$	r(   )	__name__
__module____qualname__
identifierr   r   r    staticmethodr)    r(   r&   r   r      s(    !JLJ/F r(   r   )sentry_sdk._typesr   sentry_sdk.hubr   sentry_sdk.integrationsr   sentry_sdk.scoper   sentry_sdk.utilsr   r   posthog.requestr	   posthog.sentryr
   typingr   r   r   r   r/   r(   r&   <module>r8      s2    "  / 7    ( )-# #r(   