Viewing File: /opt/hc_python/lib/python3.12/site-packages/sentry_sdk/__pycache__/api.cpython-312.pyc

�

_�*jZ>���ddlZddlZddlmZddlmZddlmZmZddl	m
Z
ddlmZddl
mZddlmZmZmZmZdd	lmZdd
lmZddlmZmZmZerbddlmZdd
lmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&ddl'm(Z(ddl)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1ddl2m3Z3dd	lmZddlm4Z4m5Z5e$d�Z6e$dedef��Z7nddd�Z&gd�Z8ded�Z9ded�Z:e9dfd��Z;de<fd�Z=e9dgd��Z>e9dgd��Z?e9dgd��Z@e9dhd!��ZAe9		di									djd&��ZBe9		did'eCd(d)d"d#d$d%dd f
d*��ZDe9		di							dkd+��ZEe9					dld,d-d.d d/d d0d d1e<ddfd2��ZFe9		di							dmd4��ZGe&dnd5��ZHe&				dod6��ZH	dp			dqd7�ZHe&dnd8��ZIe&				dod9��ZI	dp			dqd:�ZIe9d;eCd<d%ddfd=��ZJe9d;eCddfd>��ZKe9d?eCd<d%ddfd@��ZLe9drdA��ZMe9d?eCd<dBddfdC��ZNe9d?eCd<d%ddfdD��ZOe9dsdE��ZPe9dtdF��ZQe:		di					dudG��ZRe:		di					dudH��ZSe9				dvdI��ZTe9dej�dfdJdKdLeCdMdNd3dOddPf
dQ��ZVdwdReCd<eWdSdTddfdU�ZX	dp			dxdV�ZdhdW�ZYdhdX�ZZ				dydYdBdZd dRd d[d d\eCdd]fd^�Z[e9	dzd_eCddfd`��Z\e9d{da��Z]e9dpdReCd[d ddfdb��Z^				d|									d}dc�Z_y)~�N)�contextmanager)�
TYPE_CHECKING)�Client�
tracing_utils)�init)�INSTRUMENTER)�monitor)�Scope�
_ScopeManager�isolation_scope�	new_scope)�StreamedSpan)�get_current_span)�NoOpSpan�Transaction�trace)�Mapping)	�Any�Callable�ContextManager�Dict�	Generator�Optional�TypeVar�Union�overload)�Unpack)�
Breadcrumb�BreadcrumbHint�Event�ExcInfo�Hint�LogLevelStr�MeasurementUnit�SamplingContext)�
BaseClient)�Span�TransactionKwargs�T�F.)�bound�returnc��|S�N�)�xs �=/opt/hc_python/lib/python3.12/site-packages/sentry_sdk/api.pyrr1s����)'r�add_attachment�add_breadcrumb�
capture_event�capture_exception�capture_message�configure_scope�continue_trace�flush�flush_async�get_baggage�
get_client�get_global_scope�get_isolation_scope�get_current_scoper�get_traceparent�is_initializedr�
last_event_idr
�
push_scope�remove_attribute�
set_attribute�set_context�	set_extra�	set_level�set_measurement�set_tag�set_tags�set_user�
start_span�start_transactionrr	�
start_session�end_session�set_transaction_name�update_current_spanc��d|jz�dtjtt|j����|_|S)Nz(Alias for :py:meth:`sentry_sdk.Scope.%s`�

)�__name__�inspect�getdoc�getattrr
�__doc__��fs r1�scopemethodr]as5��2�Q�Z�Z�?����w�u�a�j�j�1�2��A�I�
�Hr2c��d|jz�dtjtt|j����|_|S)Nz)Alias for :py:meth:`sentry_sdk.Client.%s`rU)rVrWrXrYrrZr[s r1�clientmethodr_is5��3�a�j�j�@����w�v�q�z�z�2�3��A�I�
�Hr2c�*�tj�Sr.)r
r=r/r2r1r=r=qs������r2c�2�t�j�S)z�
    .. versionadded:: 2.0.0

    Returns whether Sentry has been initialized or not.

    If a client is available and the client is active
    (meaning it is configured to send data) then
    Sentry is initialized.
    )r=�	is_activer/r2r1rBrBvs���<�!�!�#�#r2c�*�tj�Sr.)r
r>r/r2r1r>r>�s���!�!�#�#r2c�*�tj�Sr.)r
r?r/r2r1r?r?�s���$�$�&�&r2c�*�tj�Sr.)r
r@r/r2r1r@r@�s���"�"�$�$r2�
Optional[str]c�*�tj�S)zn
    See :py:meth:`sentry_sdk.Scope.last_event_id` documentation regarding
    this method's limitations.
    )r
rCr/r2r1rCrC�s����� � r2�scope�
Optional[Any]�scope_kwargsrc�>�t�j||fd|i|��S�Nrh)r@r5)�event�hintrhrjs    r1r5r5�s'��-���,�,�U�D�V��V��V�Vr2�message�levelzOptional[LogLevelStr]c�>�t�j||fd|i|��Srl)r@r7)rorprhrjs    r1r7r7�s2��/���.�.����#��'3��r2c�<�t�j|fd|i|��Srl)r@r6)�errorrhrjs   r1r6r6�s%��1���0�0��T�e�T�|�T�Tr2�bytesz'Union[None, bytes, Callable[[], bytes]]�filename�path�content_type�add_to_transactionsc�<�t�j|||||�Sr.)r?r3)rtrurvrwrxs     r1r3r3�s&��� �/�/�
�x��|�-@��r2�kwargsc�:�t�j||fi|��Sr.)r?r4)�crumbrnrzs   r1r4r4�s"��0�� �/�/��t�F�v�F�Fr2c��yr.r/r/r2r1r8r8����r2c��yr.r/��callbacks r1r8r8����	r2c���tjdtd��t���j	�|�	|��yt
d�fd��}|�S)z�
    Reconfigures the scope.

    :param callback: If provided, call the callback with the current scope.

    :returns: If no callback is provided, returns a context manager that returns the scope.
    z�sentry_sdk.configure_scope is deprecated and will be removed in the next major version. Please consult our migration guide to learn how to migrate to the new API: https://docs.sentry.io/platforms/python/migration/1.x-to-2.x#scope-configuring���
stacklevelNc3��K����y�wr.r/�rhs�r1�innerzconfigure_scope.<locals>.inner�s�������s�	)r,zGenerator[Scope, None, None])�warnings�warn�DeprecationWarningr?�generate_propagation_contextr)r�r�rhs  @r1r8r8�s`���
�M�M�	Y�	���
 �!�E�	�&�&�(������������7�Nr2c��yr.r/r/r2r1rDrD�r~r2c��yr.r/r�s r1rDrDr�r2c�(�tjdtd��|�Stj�5tjdt�t�5}||�ddd�ddd�yt
�S#1swY�xYw#1swYyxYw)a
    Pushes a new layer on the scope stack.

    :param callback: If provided, this method pushes a scope, calls
        `callback`, and pops the scope again.

    :returns: If no `callback` is provided, a context manager that should
        be used to pop the scope again.
    z�sentry_sdk.push_scope is deprecated and will be removed in the next major version. Please consult our migration guide to learn how to migrate to the new API: https://docs.sentry.io/platforms/python/migration/1.x-to-2.x#scope-pushingr�r�N�ignore)r�r�r��catch_warnings�simplefilterrDr)r�rhs  r1rDrD
s{��
�M�M�	U�	�����
�
$�
$�
&��!�!�(�,>�?��������'���?��	���'��s#�%B�	A<�!B�<B	�B�B�	attribute�valuec�6�t�j||�S)z�
    Set an attribute.

    Any attributes-based telemetry (logs, metrics) captured in this scope will
    include this attribute.
    )r?rF)r�r�s  r1rFrF(s��� �.�.�y�%�@�@r2c�4�t�j|�S)z�
    Remove an attribute.

    If the attribute doesn't exist, this function will not have any effect and
    it will also not raise an exception.
    )r?rE)r�s r1rErE3s��� �1�1�)�<�<r2�keyc�6�t�j||�Sr.)r?rK�r�r�s  r1rKrK>s��� �(�(��e�4�4r2c�4�t�j|�Sr.)r?rL)�tagss r1rLrLCs��� �)�)�$�/�/r2zDict[str, Any]c�6�t�j||�Sr.)r?rGr�s  r1rGrGHs��� �,�,�S�%�8�8r2c�6�t�j||�Sr.)r?rHr�s  r1rHrHMs��� �*�*�3��6�6r2c�4�t�j|�Sr.)r?rM�r�s r1rMrMRs��� �)�)�%�0�0r2c�4�t�j|�Sr.)r?rIr�s r1rIrIWs��� �*�*�5�1�1r2c�8�t�j||��S�N��timeoutr�)r=r:r�s  r1r:r:\s��
�<���g���A�Ar2c��TK�t�j||���d{���S7��wr�)r=r;r�s  r1r;r;ds&����
��)�)�'�H�)�M�M�M�M�s�(�&�(c�6�t�jdi|��S)Nr/)r@rN)rzs r1rNrNls��*���)�)�3�F�3�3r2�transactionzOptional[Transaction]�instrumenter�custom_sampling_contextzOptional[SamplingContext]zUnpack[TransactionKwargs]zUnion[Transaction, NoOpSpan]c�<�t�j|||fi|��S)aV
    Start and return a transaction on the current scope.

    Start an existing transaction if given, otherwise create and start a new
    transaction with kwargs.

    This is the entry point to manual tracing instrumentation.

    A tree structure can be built by adding child spans to the transaction,
    and child spans to other spans. To start a new child span within the
    transaction or any span, call the respective `.start_child()` method.

    Every child span must be finished before the transaction is finished,
    otherwise the unfinished spans are discarded.

    When used as context managers, spans and transactions are automatically
    finished at the end of the `with` block. If not using context managers,
    call the `.finish()` method.

    When the transaction is finished, it will be sent to Sentry with all its
    finished child spans.

    :param transaction: The transaction to start. If omitted, we create and
        start a new transaction.
    :param instrumenter: This parameter is meant for internal use only. It
        will be removed in the next major version.
    :param custom_sampling_context: The transaction's custom sampling context.
    :param kwargs: Optional keyword arguments to be passed to the Transaction
        constructor. See :py:class:`sentry_sdk.tracing.Transaction` for
        available arguments.
    )r@rO)r�r�r�rzs    r1rOrOss.��L1���0�0��\�#:��>D��r2�name�unitr$c�X�t�j}|�|j|||�yy)zs
    .. deprecated:: 2.28.0
        This function is deprecated and will be removed in the next major release.
    N)r@r�rJ)r�r�r�r�s    r1rJrJ�s/��
$�%�1�1�K����#�#�D�%��6�r2c�,�tj|�S)zU
    Returns the currently active span if there is one running, otherwise `None`
    )rrr�s r1rr�s���)�)�%�0�0r2c�2�t�j�S)zP
    Returns the traceparent either from the active span or from the scope.
    )r@rAr/r2r1rArA�s����.�.�0�0r2c�X�t�j�}|�|j�Sy)zH
    Returns Baggage either from the active span or from the scope.
    N)r@r<�	serialize)�baggages r1r<r<�s-�� �!�-�-�/�G���� � �"�"�r2�environ_or_headers�op�source�originrc�<�t�j|||||�S)z]
    Sets the propagation context from environment or headers and returns a transaction.
    )r?r9)r�r�r�r�r�s     r1r9r9�s%��� �/�/��B��f�f��r2�session_modec�6�t�j|��S)N�r�)r?rPr�s r1rPrP�s��� �.�.�L�.�I�Ir2c�2�t�j�Sr.)r?rQr/r2r1rQrQ�s��� �,�,�.�.r2c�6�t�j||�Sr.)r@rR)r�r�s  r1rRrR�s����3�3�D�&�A�Ar2c�2�tt�t�rtjdt
d��yt
�}|�y|�||_|�||_|�
|�td��|�tjdt
d��|}|�|j|�yy)a�
    Update the current active span with the provided parameters.

    This function allows you to modify properties of the currently active span.
    If no span is currently active, this function will do nothing.

    :param op: The operation name for the span. This is a high-level description
        of what the span represents (e.g., "http.client", "db.query").
        You can use predefined constants from :py:class:`sentry_sdk.consts.OP`
        or provide your own string. If not provided, the span's operation will
        remain unchanged.
    :type op: str or None

    :param name: The human-readable name/description for the span. This provides
        more specific details about what the span represents (e.g., "GET /api/users",
        "SELECT * FROM users"). If not provided, the span's name will remain unchanged.
    :type name: str or None

    :param data: A dictionary of key-value pairs to add as data to the span. This
        data will be merged with any existing span data. If not provided,
        no data will be added.

        .. deprecated:: 2.35.0
            Use ``attributes`` instead. The ``data`` parameter will be removed
            in a future version.
    :type data: dict[str, Union[str, int, float, bool]] or None

    :param attributes: A dictionary of key-value pairs to add as attributes to the span.
        Attribute values must be strings, integers, floats, or booleans. These
        attributes will be merged with any existing span data. If not provided,
        no attributes will be added.
    :type attributes: dict[str, Union[str, int, float, bool]] or None

    :returns: None

    .. versionadded:: 2.35.0

    Example::

        import sentry_sdk
        from sentry_sdk.consts import OP

        sentry_sdk.update_current_span(
            op=OP.FUNCTION,
            name="process_user_data",
            attributes={"user_id": 123, "batch_size": 50}
        )
    z�The `update_current_span` API isn't available in streaming mode. Retrieve the current span with get_current_span() and use its API directly.r�r�NzJCannot provide both `data` and `attributes`. Please use only `attributes`.zDThe `data` parameter is deprecated. Please use `attributes` instead.)�
isinstance�_get_current_streamed_spanrr�r�r�rr��description�
ValueError�update_data)r�r��
attributes�data�current_spans     r1rSrS�s���l�,�.��=��
�
�
�
��	
�	�#�%�L����	�~������#'�� ���J�2��X�
�	
����
�
�R���	
�
�
���� � ��,�r2)r0r)r,r))r\r*r,r*)r,r&)r,r
)r,rf)NN)
rmr rnzOptional[Hint]rhrirjrr,rf)rsz'Optional[Union[BaseException, ExcInfo]]rhrirjrr,rf)NNNNF)r|zOptional[Breadcrumb]rnzOptional[BreadcrumbHint]rzrr,N)r,zContextManager[Scope])r�zCallable[[Scope], None]r,Nr.)r�z!Optional[Callable[[Scope], None]]r,zOptional[ContextManager[Scope]])r�zMapping[str, object]r,N)r�zOptional[Dict[str, Any]]r,N)r�r#r,N)r�zOptional[float]r�z&Optional[Callable[[int, float], None]]r,N)rzrr,r')�)rhzOptional[Scope]r,zOptional[Span])NNN�manual)�application)r,N)NNNN)
r�rfr�rfr�z1Optional[dict[str, Union[str, int, float, bool]]]r�zOptional[dict[str, Any]]r,N)`rWr��
contextlibr�typingr�
sentry_sdkrr�sentry_sdk._init_implementationr�sentry_sdk.constsr�sentry_sdk.cronsr	�sentry_sdk.scoper
rrr
�sentry_sdk.tracesrrr��sentry_sdk.tracingrrr�collections.abcrrrrrrrrrr�typing_extensionsr�sentry_sdk._typesrrr r!r"r#r$r%�sentry_sdk.clientr&r'r(r)r*�__all__r]r_r=�boolrBr>r?r@rCr5�strr7r6r3r4r8rDrFrErKrLrGrHrMrIr:r;rN�SENTRYrO�floatrJrAr<r9rPrQrRrSr/r2r1�<module>r�sa����%� �,�0�*�$�M�M�*�L�;�;��'�
�
�
�)�	�	�	�-�.�:����A���8�C��H�-�.�A��
(��V
�
�
��
��
$��
$�
�$�
�$�
�'�
�'�
�%�
�%�
�!�
�!�
�"�!�W��W�
�W��W��	W�
�W�
�W�
�&*�!��
��"�����	�
��
��
�7;�!�U�4�U��U��U��	U�
�U�
�7;� $� �$(� %�	�4�	��	��	�"�		�
�	�
�
	�
�	�
�$(�'+�G�!�G�
$�G��G�
�	G�
�G�
�	�
�	�
�	�'�	�	�	�
�	�59��1��&��D
�	�
�	�
�	�'�	�	�	�
�	�59��1��&��<
�A�S�A��A�4�A�
�A�
�=��=��=�
�=�
�5��5�U�5�t�5�
�5�
�0�
�0�
�9�S�9�!1�9�d�9�
�9�
�7�3�7�u�7��7�
�7�
�1�
�1�
�2�
�2��!%�9=�B�
�B�6�B�
�B��B��!%�9=�N�
�N�6�N�
�N��N�
�4��4��4�
�4�
�+/�$�+�+�;?�'�(�'��'�9�'�*�	'�
$�'�
�'�T7�#�7�e�7�3D�7�d�7� $�1��1��1�1��� �"���(������
�	�

���
�
�%�J��J�	�J�
�J�
�/�
�/�
�B�s�B�O�B�t�B�
�B�
� �FJ�'+�	Z-��Z-�
�Z-�D�Z-�%�	Z-�

�Z-r2
Back to Directory File Manager