Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
span.cpython-313.pyc279 linesDownload Raw Back to __pycache__
1�

2��j�L���SSKrSSKrSSKrSSKrSSKrSSKrSSKJrJ	r	 SSK3Jr Sr\R"\5r
Sr\R"\5rSr\R"S5r\R"S\S	\S435r\R&"\5rS\S\S
\4Sjr"SS\R25r"SS\5r\R;5r"SS\R>\\45r \ R;5r!SS-S-5r"Sr#"SS\RH\\\SS\45r%"SS\5r&Sr'Sr(\%"\(\'S\\!S9r)\&"\)5r*S\S
\4S jr+S!\S
\4S"jr,g)#�N)�Status�6StatusCode)�typeszU[a-z][_0-9a-z\-\*\/]{0,255}|[a-z0-9][_0-9a-z\-\*\/]{0,240}@[a-z][_0-9a-z\-\*\/]{0,13}zA[\x20-\x2b\x2d-\x3c\x3e-\x7e]{0,255}[\x21-\x2b\x2d-\x3c\x3e-\x7e]� z
[ \t]*,[ \t]*�(z)(=)(z)[ 	]*�key�value�returnc���[U[5=(aL [RU5SL=(a. [U[5=(a [RU5SL$�N)�7isinstance�str�_KEY_PATTERN�	fullmatch�_VALUE_PATTERN)rr	s  �^D:\code\apps\devtools\python\user_packages\Python313\site-packages\opentelemetry/trace/span.py�_is_valid_pairr/sR���3���	8��"�"�3�'�t�3�	8��u�c�"�	8�
�$�$�U�+�4�7�	�c��\rSrSrSr\RS!S\R\	SS4Sjj5r8\RS"Sj5r\RS	\R\
\R4SS4S9j5r\RS\
S\RSS4S
j5r\RS#S\
S	\R$S\R\	SS4Sjj5rS!SSS	\R$SS4Sjjr\RS\
SS4Sj5r\RS\4Sj5r\RS!S\R0\\4S\R\
SS4Sjj5r\RS$S\S	\R$S\R\	S\SS410Sjj5rS%SjrS\R\R>\S\R\S\R\ RBSS4Sjr"S r#g)&�Span�8z4A span represents a single operation within a trace.N�end_timer11c��g)z�Sets the current time as the span's end time.12 13The span's end time is the wall time at which the operation finished.14 15Only the first call to `end` should modify the span, and16implementations are free to ignore or raise on further calls.17N���selfrs  r�end�Span.end;��r�SpanContextc��g)z�Gets the span's SpanContext.18 19Get an immutable, serializable identifier for this span that can be20used to create new child spans.21 22Returns:23    A :class:`opentelemetry.trace.SpanContext` with a copy of this span's immutable state.24Nr�rs r�get_span_context�Span.get_span_contextErr�25attributesc��g)aaSets Attributes.26 27Sets Attributes with the key and value passed as arguments dict.28 29Note: The behavior of `None` value attributes is undefined, and hence30strongly discouraged. It is also preferred to set attributes at span31creation, instead of calling this method later since samplers can only32consider information already present during span creation.33Nr�rr%s  r�set_attributes�Span.set_attributesPrrrr	c��g)afSets an Attribute.34 35Sets a single Attribute with the key and value passed as arguments.36 37Note: The behavior of `None` value attributes is undefined, and hence38strongly discouraged. It is also preferred to set attributes at span39creation, instead of calling this method later since samplers can only40consider information already present during span creation.41Nr�rrr	s   r�
set_attribute�Span.set_attribute^rr�name�	timestampc��g)z�Adds an `Event`.42 43Adds a single `Event` with the name and, optionally, a timestamp and44attributes passed as arguments. Implementations should generate a45timestamp if the `timestamp` argument is omitted.46Nr�rr.r%r/s    r�	add_event�Span.add_eventjrr�contextc�0�[R"S5 g)a�Adds a `Link`.47 48Adds a single `Link` with the `SpanContext` of the span to link to and,49optionally, attributes passed as arguments. Implementations may ignore50calls with an invalid span context if both attributes and TraceState51are empty.52 53Note: It is preferred to add links at span creation, instead of calling54this method later since samplers can only consider information already55present during span creation.56zsSpan.add_link() not implemented and will be a no-op. Use opentelemetry-sdk >= 1.23 to add links after span creationN)�warnings�warn�rr4r%s   r�add_link�
Span.add_linkxs�� 	�
�
�
M�	57rc��g)z�Updates the `Span` name.58 59This will override the name provided via :func:`opentelemetry.trace.Tracer.start_span`.60 61Upon this update, any sampling behavior based on Span name will depend62on the implementation.63Nr�rr.s  r�update_name�Span.update_name�rrc��g)z�Returns whether this span will be recorded.64 65Returns true if this Span is active and recording information like66events with the add_event operation and attributes using set_attribute.67Nrr"s r�is_recording�Span.is_recording�rr�status�descriptionc��g)zRSets the Status of the Span. If used, this will override the default68Span status.69Nr�rrBrCs   r�70set_status�Span.set_status�rr�	exception�escapedc��g)z%Records an exception as a span event.Nr�rrHr%r/rIs     r�record_exception�Span.record_exception�rrc��U$)zNInvoked when `Span` is used as a context manager.71 72Returns the `Span` itself.73rr"s r�	__enter__�Span.__enter__�s	��74�r�exc_type�exc_val�exc_tbc�$�UR5 g)z3Ends context manager and calls `end` on the `Span`.N)r)rrQrRrSs    r�__exit__�
Span.__exit__�s
��	
���75rrr�r76r �NN�NNF)r77r)$�__name__�78__module__�__qualname__�__firstlineno__�__doc__�abc�abstractmethod�typing�Optional�intrr#�Mappingrr�AttributeValuer(r,�79Attributesr2r9r=�boolr@�UnionrrrF�
BaseExceptionrLrO�Type�python_types�
TracebackTyperU�__static_attributes__rrrrr8s���>�����F�O�O�C�0��D����	������	���� �.�.��e�.B�.B�)B�C��	
����	���	��	�U�-A�-A�	�d�	��	�	���(,�*.�	����$�$���?�?�3�'�	�8081���� (,�82��83��$�$�84�85�	86�*	����������	����d����	���-1�����V�Z�/�0���_�_�S�)��87�	���	���(,�*.��4� �4��$�$�4��?�?�3�'�	4�88�4�89�
4��4����/�/�&�+�+�m�"<�=������/������ :� :�;�	�9091�rrc�L�\rSrSrSrSrSr\S92Sj5r\	S\934Sj5rSrg	)�94TraceFlags��aZA bitmask that represents options specific to the trace.95 96The only supported option is the "sampled" flag (``0x01``). If set, this97flag indicates that the trace may have been sampled upstream.98 99See the `W3C Trace Context - Traceparent`_ spec for details.100 101.. _W3C Trace Context - Traceparent:102    https://www.w3.org/TR/trace-context/#trace-flags103r�r104c�&�U"UR5$r)�DEFAULT��clss r�get_default�TraceFlags.get_default�s���3�;�;��rc�:�[U[R-5$r)rgro�SAMPLEDr"s r�sampled�TraceFlags.sampled�s���D�:�-�-�-�.�.rrN�r105ro)
rZr[r\r]r^rsry�classmethodrv�propertyrgrzrmrrrroro�s@��	��G��G�� �� ��/��/��/rroc���\rSrSrSrSS\R\R\R\	\	4SS4Sjjr106S\S\4Sjr
S	\	S\	4S107jrS\R\	4SjrS\4SjrS\	4S
jrS	\	S\	SS4SjrS	\	S\	SS4SjrS	\	SS4SjrS\	4Sjr\S\R2\	SS4Sj5r\SSj5rS\R8\	4SjrS\R<\	\	44SjrS\R@\	4Sjr!Sr"g)�108TraceState��axA list of key-value pairs representing vendor-specific trace info.109 110Keys and values are strings of up to 256 printable US-ASCII characters.111Implementations should conform to the `W3C Trace Context - Tracestate`_112spec, which describes additional restrictions on valid field values.113 114.. _W3C Trace Context - Tracestate:115    https://www.w3.org/TR/trace-context/#tracestate-field116N�entriesr117c�F�0UlUcg[U5[:�a[R	S[5 gUHbup#[X#5(a7X R;a[R	SU5 M<X0RU'ML[R	SX#5 Md g)Nz,There can't be more than %s key/value pairs.zDuplicate key: %s found.�&Invalid key/value pair (%s, %s) found.)�_dict�len�%_TRACECONTEXT_MAXIMUM_TRACESTATE_KEYS�_logger�warningr)rr�rr	s    r�__init__�TraceState.__init__�s�����118��?���w�<�?�?��O�O�>�5�
�
�!�J�C��c�)�)��*�*�$��O�O�$>��D��"'�119�120�3�����<�c��"r�itemc��XR;$r�r�)rr�s  r�__contains__�TraceState.__contains__s���z�z�!�!rrc� �URU$rr�)rrs  r�__getitem__�TraceState.__getitem__	s���z�z�#��rc�,�[UR5$r)�iterr�r"s r�__iter__�TraceState.__iter__s���D�J�J��rc�,�[UR5$r)r�r�r"s r�__len__�TraceState.__len__s���4�:�:��rc	��URR5VVs/sHupSUSUS3PM nnn[U5$s snnf)Nz{key=z, value=�})r��itemsr)rrr	�pairss    r�__repr__�TraceState.__repr__sS��#�j�j�.�.�0�121�0�122���S�E��%���+�0�	�123��5�z���	124s�Ar	c�Z�[X5(d[RSX5 U$[U5[:�a[RS5 U$XR125;a[RSU5 U$X4/[
UR126R55-n[U5$)a�Adds a key-value pair to tracestate. The provided pair should127adhere to w3c tracestate identifiers format.128 129Args:130    key: A valid tracestate key to add131    value: A valid tracestate value to add132 133Returns:134    A new TraceState with the modifications applied.135 136    If the provided key-value pair is invalid or results in tracestate137    that violates tracecontext specification, they are discarded and138    same tracestate will be returned.139r�z'There can't be more 32 key/value pairs.z#The provided key %s already exists.)	rr�r�r�r�r��listr�r�)rrr	�	new_states    r�add�TraceState.adds����c�)�)��O�O�8�#�
��K��t�9�=�=��O�O�E�F��K��*�*���O�O�A�3�G��K��\�N�T�$�*�*�*:�*:�*<�%=�=�	��)�$�$rc���[X5(d[RSX5 U$URR	5nURUS5 X4/UR
5Qn[U5$)a�Updates a key-value pair in tracestate. The provided pair should140adhere to w3c tracestate identifiers format.141 142Args:143    key: A valid tracestate key to update144    value: A valid tracestate value to update for key145 146Returns:147    A new TraceState with the modifications applied.148 149    If the provided key-value pair is invalid or results in tracestate150    that violates tracecontext specification, they are discarded and151    same tracestate will be returned.152r�N)rr�r�r��copy�popr�r�)rrr	�153prev_stater�s     r�update�TraceState.update8sh���c�)�)��O�O�8�#�
��K��Z�Z�_�_�&�154����s�D�!��\�7�J�$4�$4�$6�7�	��)�$�$rc���XR;a[RSU5 U$URR5nUR	U5 [UR
55n[U5$)agDeletes a key-value from tracestate.155 156Args:157    key: A valid tracestate key to remove key-value pair from tracestate158 159Returns:160    A new TraceState with the modifications applied.161 162    If the provided key-value pair is invalid or results in tracestate163    that violates tracecontext specification, they are discarded and164    same tracestate will be returned.165z"The provided key %s doesn't exist.)r�r�r�r�r�r�r�r�)rrr�r�s    r�delete�TraceState.deleteQs\���j�j� ��O�O�@�#�F��K��Z�Z�_�_�&�166����s����)�)�+�,�	��)�$�$rc�b�SRSURR555$)z�Creates a w3c tracestate header from a TraceState.167 168Returns:169    A string that adheres to the w3c tracestate170    header format.171�,c3�6# �UHupUS-U-v� M g7f)�=Nr)�.0rr	s   r�	<genexpr>�'TraceState.to_header.<locals>.<genexpr>ms���O�<N�j�c��c�	�E�)�<N�s�)�joinr�r�r"s r�	to_header�TraceState.to_headerfs&���x�x�O�D�J�J�<L�<L�<N�O�O�Or�header_listc�|�0nUH�n[R"[U5nUHrnU(dM[R	U5nU(d![172R
SU5 U"5s s $UR5nUup�n173X�;aU"5s s $X�U'Mt M� U"[UR555$)a�Parses one or more w3c tracestate header into a TraceState.174 175Args:176    header_list: one or more w3c tracestate headers.177 178Returns:179    A valid TraceState that contains values extracted from180    the tracestate header.181 182    If the format of one headers is illegal, all values will183    be discarded and an empty tracestate will be returned.184 185    If the number of keys is beyond the maximum, all values186    will be discarded and an empty tracestate will be returned.187z2Member doesn't match the w3c identifiers format %s)188�re�split�_delimiter_pattern�_member_patternrr�r��groupsr�r�)rur�r��header�members�member�matchr�r�_eqr	s           r�from_header�TraceState.from_headeros���"��!�F�(*���1C�V�(L�G�!����'�1�1�&�9����O�O�L����5�L�16�����"(���%��<��5�L�"�c�189�!"�"�&�4����
�&�'�'rc��U"5$rrrts rrv�TraceState.get_default�s	���u�rc�6�URR5$r)r��keysr"s rr��TraceState.keys�s���z�z��� � rc�6�URR5$r)r�r�r"s rr��TraceState.items�s���z�z���!�!rc�6�URR5$r)r��valuesr"s rr��TraceState.values�s���z�z� � �"�"rr�r�r190r�)#rZr[r\r]r^rarb�Sequence�Tuplerr��objectrgr�r��Iteratorr�rcr�r�r�r�r�r�r}�Listr�rv�KeysViewr��	ItemsViewr��191ValuesViewr�rmrrrr�r��st���
�	�����O�O�F�L�L��c��2�3�192��193194��6"��"�D�"��s��s�� �&�/�/�#�.� �����#��%�s�%�3�%�<�%�>%�#�%�c�%�l�%�2%�#�%�,�%�*P�3�P��$(�f�k�k�#�&6�$(�<�$(��$(�L����!�f�o�o�c�*�!�"�v�'�'��S��1�"�#��)�)�#�.�#rr���rql����c
�b�\rSrSrSr\\4S\S\S\S\	RSS\	RS	S195S4SjjrS196\	R\\\SS	44Sjr
\S197\4S
j5r\S198\4Sj5r\S199\4Sj5r\SSj5r\SSj5r\S200\4Sj5rS\S201S4SjrS\S202S4SjrS203\4SjrSrg)r i�a�The state of a Span to propagate between processes.204 205This class includes the immutable attributes of a :class:`.Span` that must206be propagated to a span's children and across process boundaries.207 208Args:209    trace_id: The ID of the trace that this span belongs to.210    span_id: This span's ID.211    is_remote: True if propagated from a remote parent.212    trace_flags: Trace options to propagate.213    trace_state: Tracing-system-specific info to propagate.214�trace_id�span_id�	is_remote�trace_flagsro�trace_stater�r215c	���Uc[nUc[n[Us=:=(a	 [:*Os =(a [Us=:=(a	 [216:*Os n[RUXX4XV45$r)�DEFAULT_TRACE_OPTIONS�DEFAULT_TRACE_STATE�INVALID_TRACE_ID�_TRACE_ID_MAX_VALUE�INVALID_SPAN_ID�_SPAN_ID_MAX_VALUE�tuple�__new__)rur�r�r�r�r��is_valids       rr��SpanContext.__new__�si����/�K���-�K�
�x�>�>�+>�>�
@��'�?�?�-?�?�	�217�}�}��
�	��N�218�	219rc�t�URURURURUR4$r�r�r�r�r�r�r"s r�__getnewargs__�SpanContext.__getnewargs__�s5��
�M�M��L�L��N�N�������220�	221rc��US$)Nrrr"s rr��SpanContext.trace_id�����A�w�rc��US$)Nrqrr"s rr��SpanContext.span_id�r�rc��US$)Nr�rr"s rr��SpanContext.is_remote�r�rc��US$)N�rr"s rr��SpanContext.trace_flags�r�rc��US$)N�rr"s rr��SpanContext.trace_state�r�rc��US$)N�rr"s rr��SpanContext.is_valid�r�r�argsNc�,�[RSSS9 g�Nz.Immutable type, ignoring call to set attributeT)�222stack_info�r��debug�rrs  r�__setattr__�SpanContext.__setattr__�����
�
�<��	�	223rc�,�[RSSS9 grrrs  r�__delattr__�SpanContext.__delattr__�r224rc���[U5RS[UR5S[	UR2255SURSSUR<SURS3$)Nz(trace_id=0xz, span_id=0xz, trace_flags=0x�02xz, trace_state=z, is_remote=�))	�typerZ�format_trace_idr��format_span_idr�r�r�r�r"s rr��SpanContext.__repr__�s����t�*�%�%�&�l�?�4�=�=�3Q�2R�R^�_m�nr�nz�nz�_{�^|�}M�NR�N^�N^�_b�Mc�cq�rv�rB�rB�qE�EQ�RV�R`�R`�Qa�ab�c�	crrr|r�)rZr[r\r]r^r�r�rcrgrarbr�r�r�r~r�r�r�r�r�r�rrrr�rmrrrr r �sJ���$6K�5H�
226��227��228��	229�230�_�_�\�2�231��_�_�\�2�
232�233�234�.	235�	���c�3��l�L�@�	A�	236���#������������4��������������$����237��238��239�240241��242��243�244c�#�crr c�"�\rSrSrSrSSjrSSjrS\4S	jrS S245\	R\SS4SjjrS\	R\\R 4SS4S
jrS\S\R SS4SjrS!S\S\R&S\	R\SS4SjjrS SSS\R&SS4SjjrS\SS4SjrS S\	R.\\4S\	R\SS4SjjrS"S\S\R&S\	R\S\SS4246SjjrS\4SjrSrg)#�NonRecordingSpanizvThe Span that is used when no Span implementation is available.247 248All operations are no-op except context propagation.249r4r r250Nc��Xlgr��_context)rr4s  rr��NonRecordingSpan.__init__s���
rc��UR$rrr"s rr#�!NonRecordingSpan.get_span_context251s���}�}�rc��g)NFrr"s rr@�NonRecordingSpan.is_recording
s��rrc��grrrs  rr�NonRecordingSpan.end���rr%c��grrr's  rr(�NonRecordingSpan.set_attributess��	
rrr	c��grrr+s   rr,�NonRecordingSpan.set_attributer!rr.r/c��grrr1s    rr2�NonRecordingSpan.add_events��	
rc��grrr8s   rr9�NonRecordingSpan.add_link#���252	
rc��grrr<s  rr=�NonRecordingSpan.update_name*r!rrBrCc��grrrEs   rrF�NonRecordingSpan.set_status-r*rrHrIc��grrrKs     rrL�!NonRecordingSpan.record_exception4s��	
rc�$�SUR<S3$)NzNonRecordingSpan(rrr"s rr��NonRecordingSpan.__repr__=s��"�4�=�=�"3�1�5�5rr)r4r r253NrWrrXrY)rZr[r\r]r^r�r#rgr@rarbrcrrdrrrer(r,rfr2r9r=rhrrrFrirLr�rmrrrrrs����254 ���d��
�F�O�O�C�0�
�D�
�
� �.�.��e�.B�.B�)B�C�
�	
�
�255
��
�U�-A�-A�
�d�
�(,�*.�	
��
��$�$�
��?�?�3�'�	
�256257�
�(,�
��
��$�$�
�258�	
�
��
��
�-1�
����V�Z�/�0�
��_�_�S�)�
�259�	
�(,�*.��
� �
��$�$�
��?�?�3�'�	
�260�
�261�

�6�#�6rrFr�r�c��[US5$)z�Convenience trace ID formatting method262Args:263    trace_id: Trace ID int264 265Returns:266    The trace ID (16 bytes) cast to a 32-character hexadecimal string267�032x��format)r�s rrrMs���(�F�#�#rr�c��[US5$)z�Convenience span ID formatting method268Args:269    span_id: Span ID int270 271Returns:272    The span ID (8 bytes) cast to a 16-character hexadecimal string273�016xr5)r�s rrrXs���'�6�"�"r)-r_�loggingr�rrkrar6�opentelemetry.trace.statusrr�opentelemetry.util�_KEY_FORMAT�compiler�
_VALUE_FORMATrr�r�r��	getLoggerrZr�rrgr�ABCrrcrorvr�rdr�r�r�r�r�r rr�r��INVALID_SPAN_CONTEXT�INVALID_SPANrrrrr�<module>rCs���274��	��
��9�$�A���z�z�+�&��I�����M�*��)+�%��Z�Z� 0�1���*�*�q��
�U�=�/��I�J��275�276�277�H�278%�����C��D��J�3�7�7�J�Z/��/�0#�.�.�0��A#�����S��)�A#�H!�,�,�.����f�q�j����Uc�279�L�L��c�4��|�T�A�B�Uc�p=6�t�=6�@%��5��"�
���%�#��� � 4�5��$�c�$�c�$�#�C�#�C�#r
codekingpro/portable-devtools · Team Ai