✏️ 正在编辑: context_propagation.cpython-312.pyc
路径:
/var/opt/nydus/ops/mysql/connector/opentelemetry/__pycache__/context_propagation.cpython-312.pyc
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
� ��'j� � �| � d Z ddlmZmZmZ ddlmZmZ erddlm Z ddl mZmZ erddl mZ d ed efd�Zded efd �Zy)z$Trace context propagation utilities.� )� TYPE_CHECKING�Any�Callable� )�OTEL_ENABLED�TRACEPARENT_HEADER_NAME)�trace)�format_span_id�format_trace_id� )�MySQLConnectionAbstract�span�returnc � � | j � }d}t |j � }t |j � }d}dj ||||g� S )ah Build a traceparent header according to the provided span. The context information from the provided span is used to build the traceparent header that will be propagated to the MySQL server. For particulars regarding the header creation, refer to [1]. This method assumes version 0 of the W3C specification. Args: span (opentelemetry.trace.span.Span): current span in trace. Returns: traceparent_header (str): HTTP header field that identifies requests in a tracing system. References: [1]: https://www.w3.org/TR/trace-context/#traceparent-header �00�-)�get_span_contextr �trace_idr �span_id�join)r �ctx�versionr r �trace_flagss �b/opt/nydus/tmp/pip-target-k0fmikie/lib/python/mysql/connector/opentelemetry/context_propagation.py�build_traceparent_headerr 0 sP � �( � � � !�C��G��s�|�|�,�H��S�[�[�)�G��K��8�8�W�h���=�>�>� �methodc �<