OwlCyberSecurity - MANAGER
Edit File: monitoring.cpython-312.pyc
� G��g^ � � � d dl Z d dlmZ d dlZd dlmZ d dlmZ d dlmZ d dl m Z e r d dl mZmZm Z edd� � Zd � Zd� Zd� Z dd �Zy)� N)�wraps)� start_span)�Span)� ContextVar)� TYPE_CHECKING)�Optional�Callable�Any�ai_pipeline_name)�defaultc �. � t j | � y �N)�_ai_pipeline_name�set)�names �G/opt/hc_python/lib/python3.12/site-packages/sentry_sdk/ai/monitoring.py�set_ai_pipeline_namer s � ����$�� c �* � t j � S r )r �get� r r �get_ai_pipeline_namer s � �� � �"�"r c � � �� � �fd�}|S )Nc � �� � �� �fd�}�� �fd�}t j � � r t � � |� S t � � |� S )Nc �P �� t j � }� j d|rdnd� }t d �|d�� ��5 }|j di � j � D ] \ }}|j ||� � |j di � j � D ] \ }}|j ||� � |r#|j d|� �| i |��cd d d � S t j �� �| i |��} t j d � |cd d d � S # t $ rc}t j j |t j � j dd d ��� \ } } t j | | �� |d �d }~ww xY w# t j d � w xY w# 1 sw Y y xY w�N�opzai.runzai.pipeline)r r �sentry_tags�sentry_data�ai.pipeline.name� ai_monitoringF)�type�handled)�client_options� mechanism)�hintr �r r r �pop�items�set_tag�set_datar � Exception� sentry_sdk�utils�event_from_exception� get_client�options� capture_event��args�kwargs� curr_pipeliner �span�k�v�res�e�eventr&