forked from instana/python-sensor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformat.py
More file actions
64 lines (49 loc) · 2.37 KB
/
Copy pathformat.py
File metadata and controls
64 lines (49 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# (c) Copyright IBM Corp. 2024
class Format(object):
"""A namespace for builtin carrier formats.
These static constants are intended for use in the :meth:`Tracer.inject()`
and :meth:`Tracer.extract()` methods. E.g.::
tracer.inject(span.context, Format.BINARY, binary_carrier)
"""
BINARY = "binary"
"""
The BINARY format represents SpanContexts in an opaque bytearray carrier.
For both :meth:`Tracer.inject()` and :meth:`Tracer.extract()` the carrier
should be a bytearray instance. :meth:`Tracer.inject()` must append to the
bytearray carrier (rather than replace its contents).
"""
TEXT_MAP = "text_map"
"""
The TEXT_MAP format represents :class:`SpanContext`\\ s in a python
``dict`` mapping from strings to strings.
Both the keys and the values have unrestricted character sets (unlike the
HTTP_HEADERS format).
NOTE: The TEXT_MAP carrier ``dict`` may contain unrelated data (e.g.,
arbitrary gRPC metadata). As such, the :class:`Tracer` implementation
should use a prefix or other convention to distinguish tracer-specific
key:value pairs.
"""
HTTP_HEADERS = "http_headers"
"""
The HTTP_HEADERS format represents :class:`SpanContext`\\ s in a python
``dict`` mapping from character-restricted strings to strings.
Keys and values in the HTTP_HEADERS carrier must be suitable for use as
HTTP headers (without modification or further escaping). That is, the
keys have a greatly restricted character set, casing for the keys may not
be preserved by various intermediaries, and the values should be
URL-escaped.
NOTE: The HTTP_HEADERS carrier ``dict`` may contain unrelated data (e.g.,
arbitrary gRPC metadata). As such, the :class:`Tracer` implementation
should use a prefix or other convention to distinguish tracer-specific
key:value pairs.
"""
KAFKA_HEADERS = "kafka_headers"
"""
The KAFKA_HEADERS format represents :class:`SpanContext`\\ s in a python
``dict`` mapping from character-restricted strings to strings.
Keys and values in the KAFKA_HEADERS carrier must be suitable for use as
HTTP headers (without modification or further escaping). That is, the
keys have a greatly restricted character set, casing for the keys may not
be preserved by various intermediaries, and the values should be
URL-escaped.
"""