o
    3Ih	                     @   s   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
mZmZ d dlmZ d dlmZ erBd d	lmZ d d
l mZmZ G dd deZdS )    )MYPY)Hub)Integrationadd_global_event_processor)Dsn)capturehost)DEFAULT_HOST)POSTHOG_ID_TAG)Optional)EventHintc                   @   s(   e Zd ZdZdZdZdZedd ZdS )PostHogIntegrationzposthog-pythonNz https://sentry.io/organizations/c                  C   s   t dd } d S )Nc                 S   s   t jtd ure| ddkr| S | di tre| d t }tp#t d| | d d< | d | d d}tjr_tj	pJt jj
j  oJtt jj
jj	}|r_tj tj d	| d
| d  |d< t|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   r	   r
   organization
project_idclientdsnr   prefixr   )eventhintposthog_distinct_id
propertiesr    r!   b/home/air/sanwanet/gpt-api/venv/lib/python3.10/site-packages/posthog/sentry/posthog_integration.py	processor   s(   
z0PostHogIntegration.setup_once.<locals>.processorr   )r#   r!   r!   r"   
setup_once   s   zPostHogIntegration.setup_once)	__name__
__module____qualname__
identifierr   r   r   staticmethodr$   r!   r!   r!   r"   r      s    r   N)sentry_sdk._typesr   sentry_sdk.hubr   sentry_sdk.integrationsr   sentry_sdk.scoper   sentry_sdk.utilsr   posthogr   r	   posthog.requestr
   posthog.sentryr   typingr   r   r   r   r!   r!   r!   r"   <module>   s    