o
    g                     @   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
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 deZdS )    )MYPY)Hub)Integrationadd_global_event_processor)DsnN)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rg| ddkr| S | di trg| d t }tjp$t d| | d d< | d | d d}tj	r`tj
pKt jjj  oKt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	   posthoghostr   organization
project_idclientdsnr   prefixcapture)eventhintposthog_distinct_id
propertiesr    r"   Y/var/www/visachat/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   )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"   r#   <module>   s    