opentelemetry-instrumentation 0.50b0__py3-none-any.whl → 0.52b0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- opentelemetry/instrumentation/_semconv.py +69 -44
- opentelemetry/instrumentation/auto_instrumentation/__init__.py +23 -0
- opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py +1 -28
- opentelemetry/instrumentation/bootstrap_gen.py +67 -55
- opentelemetry/instrumentation/dependencies.py +8 -7
- opentelemetry/instrumentation/utils.py +12 -10
- opentelemetry/instrumentation/version.py +1 -1
- {opentelemetry_instrumentation-0.50b0.dist-info → opentelemetry_instrumentation-0.52b0.dist-info}/METADATA +20 -4
- {opentelemetry_instrumentation-0.50b0.dist-info → opentelemetry_instrumentation-0.52b0.dist-info}/RECORD +12 -12
- {opentelemetry_instrumentation-0.50b0.dist-info → opentelemetry_instrumentation-0.52b0.dist-info}/WHEEL +1 -1
- {opentelemetry_instrumentation-0.50b0.dist-info → opentelemetry_instrumentation-0.52b0.dist-info}/entry_points.txt +0 -0
- {opentelemetry_instrumentation-0.50b0.dist-info → opentelemetry_instrumentation-0.52b0.dist-info}/licenses/LICENSE +0 -0
@@ -109,23 +109,23 @@ OTEL_SEMCONV_STABILITY_OPT_IN = "OTEL_SEMCONV_STABILITY_OPT_IN"
|
|
109
109
|
|
110
110
|
class _OpenTelemetryStabilitySignalType:
|
111
111
|
HTTP = "http"
|
112
|
+
DATABASE = "database"
|
112
113
|
|
113
114
|
|
114
|
-
class
|
115
|
-
|
115
|
+
class _StabilityMode(Enum):
|
116
|
+
DEFAULT = "default"
|
116
117
|
HTTP = "http"
|
117
|
-
# http/dup - emit both the old and the stable HTTP and networking conventions
|
118
118
|
HTTP_DUP = "http/dup"
|
119
|
-
|
120
|
-
|
119
|
+
DATABASE = "database"
|
120
|
+
DATABASE_DUP = "database/dup"
|
121
121
|
|
122
122
|
|
123
|
-
def _report_new(mode):
|
124
|
-
return mode
|
123
|
+
def _report_new(mode: _StabilityMode):
|
124
|
+
return mode != _StabilityMode.DEFAULT
|
125
125
|
|
126
126
|
|
127
|
-
def _report_old(mode):
|
128
|
-
return mode
|
127
|
+
def _report_old(mode: _StabilityMode):
|
128
|
+
return mode not in (_StabilityMode.HTTP, _StabilityMode.DATABASE)
|
129
129
|
|
130
130
|
|
131
131
|
class _OpenTelemetrySemanticConventionStability:
|
@@ -135,35 +135,61 @@ class _OpenTelemetrySemanticConventionStability:
|
|
135
135
|
|
136
136
|
@classmethod
|
137
137
|
def _initialize(cls):
|
138
|
-
with
|
139
|
-
if
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
138
|
+
with cls._lock:
|
139
|
+
if cls._initialized:
|
140
|
+
return
|
141
|
+
|
142
|
+
# Users can pass in comma delimited string for opt-in options
|
143
|
+
# Only values for http and database stability are supported for now
|
144
|
+
opt_in = os.environ.get(OTEL_SEMCONV_STABILITY_OPT_IN)
|
145
|
+
|
146
|
+
if not opt_in:
|
147
|
+
# early return in case of default
|
148
|
+
cls._OTEL_SEMCONV_STABILITY_SIGNAL_MAPPING = {
|
149
|
+
_OpenTelemetryStabilitySignalType.HTTP: _StabilityMode.DEFAULT,
|
150
|
+
_OpenTelemetryStabilitySignalType.DATABASE: _StabilityMode.DEFAULT,
|
151
|
+
}
|
152
|
+
cls._initialized = True
|
153
|
+
return
|
154
|
+
|
155
|
+
opt_in_list = [s.strip() for s in opt_in.split(",")]
|
156
|
+
|
157
|
+
cls._OTEL_SEMCONV_STABILITY_SIGNAL_MAPPING[
|
158
|
+
_OpenTelemetryStabilitySignalType.HTTP
|
159
|
+
] = cls._filter_mode(
|
160
|
+
opt_in_list, _StabilityMode.HTTP, _StabilityMode.HTTP_DUP
|
161
|
+
)
|
162
|
+
|
163
|
+
cls._OTEL_SEMCONV_STABILITY_SIGNAL_MAPPING[
|
164
|
+
_OpenTelemetryStabilitySignalType.DATABASE
|
165
|
+
] = cls._filter_mode(
|
166
|
+
opt_in_list,
|
167
|
+
_StabilityMode.DATABASE,
|
168
|
+
_StabilityMode.DATABASE_DUP,
|
169
|
+
)
|
170
|
+
|
171
|
+
cls._initialized = True
|
172
|
+
|
173
|
+
@staticmethod
|
174
|
+
def _filter_mode(opt_in_list, stable_mode, dup_mode):
|
175
|
+
# Process semconv stability opt-in
|
176
|
+
# http/dup,database/dup has higher precedence over http,database
|
177
|
+
if dup_mode.value in opt_in_list:
|
178
|
+
return dup_mode
|
179
|
+
|
180
|
+
return (
|
181
|
+
stable_mode
|
182
|
+
if stable_mode.value in opt_in_list
|
183
|
+
else _StabilityMode.DEFAULT
|
184
|
+
)
|
158
185
|
|
159
186
|
@classmethod
|
160
|
-
# Get OpenTelemetry opt-in mode based off of signal type (http, messaging, etc.)
|
161
187
|
def _get_opentelemetry_stability_opt_in_mode(
|
162
|
-
cls,
|
163
|
-
|
164
|
-
|
165
|
-
return
|
166
|
-
signal_type,
|
188
|
+
cls, signal_type: _OpenTelemetryStabilitySignalType
|
189
|
+
) -> _StabilityMode:
|
190
|
+
# Get OpenTelemetry opt-in mode based off of signal type (http, messaging, etc.)
|
191
|
+
return cls._OTEL_SEMCONV_STABILITY_SIGNAL_MAPPING.get(
|
192
|
+
signal_type, _StabilityMode.DEFAULT
|
167
193
|
)
|
168
194
|
|
169
195
|
|
@@ -171,14 +197,12 @@ def _filter_semconv_duration_attrs(
|
|
171
197
|
attrs,
|
172
198
|
old_attrs,
|
173
199
|
new_attrs,
|
174
|
-
sem_conv_opt_in_mode=
|
200
|
+
sem_conv_opt_in_mode=_StabilityMode.DEFAULT,
|
175
201
|
):
|
176
202
|
filtered_attrs = {}
|
177
203
|
# duration is two different metrics depending on sem_conv_opt_in_mode, so no DUP attributes
|
178
204
|
allowed_attributes = (
|
179
|
-
new_attrs
|
180
|
-
if sem_conv_opt_in_mode == _HTTPStabilityMode.HTTP
|
181
|
-
else old_attrs
|
205
|
+
new_attrs if sem_conv_opt_in_mode == _StabilityMode.HTTP else old_attrs
|
182
206
|
)
|
183
207
|
for key, val in attrs.items():
|
184
208
|
if key in allowed_attributes:
|
@@ -190,7 +214,7 @@ def _filter_semconv_active_request_count_attr(
|
|
190
214
|
attrs,
|
191
215
|
old_attrs,
|
192
216
|
new_attrs,
|
193
|
-
sem_conv_opt_in_mode=
|
217
|
+
sem_conv_opt_in_mode=_StabilityMode.DEFAULT,
|
194
218
|
):
|
195
219
|
filtered_attrs = {}
|
196
220
|
if _report_old(sem_conv_opt_in_mode):
|
@@ -367,10 +391,11 @@ def _set_status(
|
|
367
391
|
status_code: int,
|
368
392
|
status_code_str: str,
|
369
393
|
server_span: bool = True,
|
370
|
-
sem_conv_opt_in_mode:
|
394
|
+
sem_conv_opt_in_mode: _StabilityMode = _StabilityMode.DEFAULT,
|
371
395
|
):
|
372
396
|
if status_code < 0:
|
373
|
-
|
397
|
+
if _report_new(sem_conv_opt_in_mode):
|
398
|
+
metrics_attributes[ERROR_TYPE] = status_code_str
|
374
399
|
if span.is_recording():
|
375
400
|
if _report_new(sem_conv_opt_in_mode):
|
376
401
|
span.set_attribute(ERROR_TYPE, status_code_str)
|
@@ -404,7 +429,7 @@ def _set_status(
|
|
404
429
|
|
405
430
|
|
406
431
|
# Get schema version based off of opt-in mode
|
407
|
-
def _get_schema_url(mode:
|
408
|
-
if mode is
|
432
|
+
def _get_schema_url(mode: _StabilityMode) -> str:
|
433
|
+
if mode is _StabilityMode.DEFAULT:
|
409
434
|
return "https://opentelemetry.io/schemas/1.11.0"
|
410
435
|
return SpanAttributes.SCHEMA_URL
|
@@ -19,6 +19,12 @@ from os.path import abspath, dirname, pathsep
|
|
19
19
|
from re import sub
|
20
20
|
from shutil import which
|
21
21
|
|
22
|
+
from opentelemetry.instrumentation.auto_instrumentation._load import (
|
23
|
+
_load_configurators,
|
24
|
+
_load_distro,
|
25
|
+
_load_instrumentors,
|
26
|
+
)
|
27
|
+
from opentelemetry.instrumentation.utils import _python_path_without_directory
|
22
28
|
from opentelemetry.instrumentation.version import __version__
|
23
29
|
from opentelemetry.util._importlib_metadata import entry_points
|
24
30
|
|
@@ -110,3 +116,20 @@ def run() -> None:
|
|
110
116
|
|
111
117
|
executable = which(args.command)
|
112
118
|
execl(executable, executable, *args.command_args)
|
119
|
+
|
120
|
+
|
121
|
+
def initialize():
|
122
|
+
"""Setup auto-instrumentation, called by the sitecustomize module"""
|
123
|
+
# prevents auto-instrumentation of subprocesses if code execs another python process
|
124
|
+
if "PYTHONPATH" in environ:
|
125
|
+
environ["PYTHONPATH"] = _python_path_without_directory(
|
126
|
+
environ["PYTHONPATH"], dirname(abspath(__file__)), pathsep
|
127
|
+
)
|
128
|
+
|
129
|
+
try:
|
130
|
+
distro = _load_distro()
|
131
|
+
distro.configure()
|
132
|
+
_load_configurators()
|
133
|
+
_load_instrumentors(distro)
|
134
|
+
except Exception: # pylint: disable=broad-except
|
135
|
+
_logger.exception("Failed to auto initialize OpenTelemetry")
|
@@ -12,33 +12,6 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
from
|
16
|
-
from os import environ
|
17
|
-
from os.path import abspath, dirname, pathsep
|
18
|
-
|
19
|
-
from opentelemetry.instrumentation.auto_instrumentation._load import (
|
20
|
-
_load_configurators,
|
21
|
-
_load_distro,
|
22
|
-
_load_instrumentors,
|
23
|
-
)
|
24
|
-
from opentelemetry.instrumentation.utils import _python_path_without_directory
|
25
|
-
|
26
|
-
logger = getLogger(__name__)
|
27
|
-
|
28
|
-
|
29
|
-
def initialize():
|
30
|
-
# prevents auto-instrumentation of subprocesses if code execs another python process
|
31
|
-
environ["PYTHONPATH"] = _python_path_without_directory(
|
32
|
-
environ["PYTHONPATH"], dirname(abspath(__file__)), pathsep
|
33
|
-
)
|
34
|
-
|
35
|
-
try:
|
36
|
-
distro = _load_distro()
|
37
|
-
distro.configure()
|
38
|
-
_load_configurators()
|
39
|
-
_load_instrumentors(distro)
|
40
|
-
except Exception: # pylint: disable=broad-except
|
41
|
-
logger.exception("Failed to auto initialize opentelemetry")
|
42
|
-
|
15
|
+
from opentelemetry.instrumentation.auto_instrumentation import initialize
|
43
16
|
|
44
17
|
initialize()
|
@@ -18,191 +18,203 @@
|
|
18
18
|
libraries = [
|
19
19
|
{
|
20
20
|
"library": "openai >= 1.26.0",
|
21
|
-
"instrumentation": "opentelemetry-instrumentation-openai-v2
|
21
|
+
"instrumentation": "opentelemetry-instrumentation-openai-v2",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"library": "google-cloud-aiplatform >= 1.64",
|
25
|
+
"instrumentation": "opentelemetry-instrumentation-vertexai>=2.0b0",
|
22
26
|
},
|
23
27
|
{
|
24
28
|
"library": "aio_pika >= 7.2.0, < 10.0.0",
|
25
|
-
"instrumentation": "opentelemetry-instrumentation-aio-pika==0.
|
29
|
+
"instrumentation": "opentelemetry-instrumentation-aio-pika==0.52b0",
|
26
30
|
},
|
27
31
|
{
|
28
32
|
"library": "aiohttp ~= 3.0",
|
29
|
-
"instrumentation": "opentelemetry-instrumentation-aiohttp-client==0.
|
33
|
+
"instrumentation": "opentelemetry-instrumentation-aiohttp-client==0.52b0",
|
30
34
|
},
|
31
35
|
{
|
32
36
|
"library": "aiohttp ~= 3.0",
|
33
|
-
"instrumentation": "opentelemetry-instrumentation-aiohttp-server==0.
|
37
|
+
"instrumentation": "opentelemetry-instrumentation-aiohttp-server==0.52b0",
|
34
38
|
},
|
35
39
|
{
|
36
40
|
"library": "aiokafka >= 0.8, < 1.0",
|
37
|
-
"instrumentation": "opentelemetry-instrumentation-aiokafka==0.
|
41
|
+
"instrumentation": "opentelemetry-instrumentation-aiokafka==0.52b0",
|
38
42
|
},
|
39
43
|
{
|
40
44
|
"library": "aiopg >= 0.13.0, < 2.0.0",
|
41
|
-
"instrumentation": "opentelemetry-instrumentation-aiopg==0.
|
45
|
+
"instrumentation": "opentelemetry-instrumentation-aiopg==0.52b0",
|
42
46
|
},
|
43
47
|
{
|
44
48
|
"library": "asgiref ~= 3.0",
|
45
|
-
"instrumentation": "opentelemetry-instrumentation-asgi==0.
|
49
|
+
"instrumentation": "opentelemetry-instrumentation-asgi==0.52b0",
|
46
50
|
},
|
47
51
|
{
|
48
52
|
"library": "asyncpg >= 0.12.0",
|
49
|
-
"instrumentation": "opentelemetry-instrumentation-asyncpg==0.
|
53
|
+
"instrumentation": "opentelemetry-instrumentation-asyncpg==0.52b0",
|
50
54
|
},
|
51
55
|
{
|
52
56
|
"library": "boto~=2.0",
|
53
|
-
"instrumentation": "opentelemetry-instrumentation-boto==0.
|
57
|
+
"instrumentation": "opentelemetry-instrumentation-boto==0.52b0",
|
54
58
|
},
|
55
59
|
{
|
56
60
|
"library": "boto3 ~= 1.0",
|
57
|
-
"instrumentation": "opentelemetry-instrumentation-boto3sqs==0.
|
61
|
+
"instrumentation": "opentelemetry-instrumentation-boto3sqs==0.52b0",
|
58
62
|
},
|
59
63
|
{
|
60
64
|
"library": "botocore ~= 1.0",
|
61
|
-
"instrumentation": "opentelemetry-instrumentation-botocore==0.
|
65
|
+
"instrumentation": "opentelemetry-instrumentation-botocore==0.52b0",
|
62
66
|
},
|
63
67
|
{
|
64
68
|
"library": "cassandra-driver ~= 3.25",
|
65
|
-
"instrumentation": "opentelemetry-instrumentation-cassandra==0.
|
69
|
+
"instrumentation": "opentelemetry-instrumentation-cassandra==0.52b0",
|
66
70
|
},
|
67
71
|
{
|
68
72
|
"library": "scylla-driver ~= 3.25",
|
69
|
-
"instrumentation": "opentelemetry-instrumentation-cassandra==0.
|
73
|
+
"instrumentation": "opentelemetry-instrumentation-cassandra==0.52b0",
|
70
74
|
},
|
71
75
|
{
|
72
76
|
"library": "celery >= 4.0, < 6.0",
|
73
|
-
"instrumentation": "opentelemetry-instrumentation-celery==0.
|
77
|
+
"instrumentation": "opentelemetry-instrumentation-celery==0.52b0",
|
74
78
|
},
|
75
79
|
{
|
76
80
|
"library": "click >= 8.1.3, < 9.0.0",
|
77
|
-
"instrumentation": "opentelemetry-instrumentation-click==0.
|
81
|
+
"instrumentation": "opentelemetry-instrumentation-click==0.52b0",
|
78
82
|
},
|
79
83
|
{
|
80
|
-
"library": "confluent-kafka >= 1.8.2, <= 2.
|
81
|
-
"instrumentation": "opentelemetry-instrumentation-confluent-kafka==0.
|
84
|
+
"library": "confluent-kafka >= 1.8.2, <= 2.7.0",
|
85
|
+
"instrumentation": "opentelemetry-instrumentation-confluent-kafka==0.52b0",
|
82
86
|
},
|
83
87
|
{
|
84
88
|
"library": "django >= 1.10",
|
85
|
-
"instrumentation": "opentelemetry-instrumentation-django==0.
|
89
|
+
"instrumentation": "opentelemetry-instrumentation-django==0.52b0",
|
86
90
|
},
|
87
91
|
{
|
88
92
|
"library": "elasticsearch >= 6.0",
|
89
|
-
"instrumentation": "opentelemetry-instrumentation-elasticsearch==0.
|
93
|
+
"instrumentation": "opentelemetry-instrumentation-elasticsearch==0.52b0",
|
90
94
|
},
|
91
95
|
{
|
92
|
-
"library": "falcon >= 1.4.1, <
|
93
|
-
"instrumentation": "opentelemetry-instrumentation-falcon==0.
|
96
|
+
"library": "falcon >= 1.4.1, < 5.0.0",
|
97
|
+
"instrumentation": "opentelemetry-instrumentation-falcon==0.52b0",
|
94
98
|
},
|
95
99
|
{
|
96
100
|
"library": "fastapi ~= 0.58",
|
97
|
-
"instrumentation": "opentelemetry-instrumentation-fastapi==0.
|
101
|
+
"instrumentation": "opentelemetry-instrumentation-fastapi==0.52b0",
|
98
102
|
},
|
99
103
|
{
|
100
104
|
"library": "flask >= 1.0",
|
101
|
-
"instrumentation": "opentelemetry-instrumentation-flask==0.
|
105
|
+
"instrumentation": "opentelemetry-instrumentation-flask==0.52b0",
|
102
106
|
},
|
103
107
|
{
|
104
108
|
"library": "grpcio >= 1.42.0",
|
105
|
-
"instrumentation": "opentelemetry-instrumentation-grpc==0.
|
109
|
+
"instrumentation": "opentelemetry-instrumentation-grpc==0.52b0",
|
106
110
|
},
|
107
111
|
{
|
108
112
|
"library": "httpx >= 0.18.0",
|
109
|
-
"instrumentation": "opentelemetry-instrumentation-httpx==0.
|
113
|
+
"instrumentation": "opentelemetry-instrumentation-httpx==0.52b0",
|
110
114
|
},
|
111
115
|
{
|
112
116
|
"library": "jinja2 >= 2.7, < 4.0",
|
113
|
-
"instrumentation": "opentelemetry-instrumentation-jinja2==0.
|
117
|
+
"instrumentation": "opentelemetry-instrumentation-jinja2==0.52b0",
|
114
118
|
},
|
115
119
|
{
|
116
120
|
"library": "kafka-python >= 2.0, < 3.0",
|
117
|
-
"instrumentation": "opentelemetry-instrumentation-kafka-python==0.
|
121
|
+
"instrumentation": "opentelemetry-instrumentation-kafka-python==0.52b0",
|
118
122
|
},
|
119
123
|
{
|
120
124
|
"library": "kafka-python-ng >= 2.0, < 3.0",
|
121
|
-
"instrumentation": "opentelemetry-instrumentation-kafka-python==0.
|
125
|
+
"instrumentation": "opentelemetry-instrumentation-kafka-python==0.52b0",
|
122
126
|
},
|
123
127
|
{
|
124
128
|
"library": "mysql-connector-python >= 8.0, < 10.0",
|
125
|
-
"instrumentation": "opentelemetry-instrumentation-mysql==0.
|
129
|
+
"instrumentation": "opentelemetry-instrumentation-mysql==0.52b0",
|
126
130
|
},
|
127
131
|
{
|
128
132
|
"library": "mysqlclient < 3",
|
129
|
-
"instrumentation": "opentelemetry-instrumentation-mysqlclient==0.
|
133
|
+
"instrumentation": "opentelemetry-instrumentation-mysqlclient==0.52b0",
|
130
134
|
},
|
131
135
|
{
|
132
136
|
"library": "pika >= 0.12.0",
|
133
|
-
"instrumentation": "opentelemetry-instrumentation-pika==0.
|
137
|
+
"instrumentation": "opentelemetry-instrumentation-pika==0.52b0",
|
134
138
|
},
|
135
139
|
{
|
136
140
|
"library": "psycopg >= 3.1.0",
|
137
|
-
"instrumentation": "opentelemetry-instrumentation-psycopg==0.
|
141
|
+
"instrumentation": "opentelemetry-instrumentation-psycopg==0.52b0",
|
138
142
|
},
|
139
143
|
{
|
140
144
|
"library": "psycopg2 >= 2.7.3.1",
|
141
|
-
"instrumentation": "opentelemetry-instrumentation-psycopg2==0.
|
145
|
+
"instrumentation": "opentelemetry-instrumentation-psycopg2==0.52b0",
|
146
|
+
},
|
147
|
+
{
|
148
|
+
"library": "psycopg2-binary >= 2.7.3.1",
|
149
|
+
"instrumentation": "opentelemetry-instrumentation-psycopg2==0.52b0",
|
142
150
|
},
|
143
151
|
{
|
144
152
|
"library": "pymemcache >= 1.3.5, < 5",
|
145
|
-
"instrumentation": "opentelemetry-instrumentation-pymemcache==0.
|
153
|
+
"instrumentation": "opentelemetry-instrumentation-pymemcache==0.52b0",
|
146
154
|
},
|
147
155
|
{
|
148
156
|
"library": "pymongo >= 3.1, < 5.0",
|
149
|
-
"instrumentation": "opentelemetry-instrumentation-pymongo==0.
|
157
|
+
"instrumentation": "opentelemetry-instrumentation-pymongo==0.52b0",
|
158
|
+
},
|
159
|
+
{
|
160
|
+
"library": "pymssql >= 2.1.5, < 3",
|
161
|
+
"instrumentation": "opentelemetry-instrumentation-pymssql==0.52b0",
|
150
162
|
},
|
151
163
|
{
|
152
164
|
"library": "PyMySQL < 2",
|
153
|
-
"instrumentation": "opentelemetry-instrumentation-pymysql==0.
|
165
|
+
"instrumentation": "opentelemetry-instrumentation-pymysql==0.52b0",
|
154
166
|
},
|
155
167
|
{
|
156
168
|
"library": "pyramid >= 1.7",
|
157
|
-
"instrumentation": "opentelemetry-instrumentation-pyramid==0.
|
169
|
+
"instrumentation": "opentelemetry-instrumentation-pyramid==0.52b0",
|
158
170
|
},
|
159
171
|
{
|
160
172
|
"library": "redis >= 2.6",
|
161
|
-
"instrumentation": "opentelemetry-instrumentation-redis==0.
|
173
|
+
"instrumentation": "opentelemetry-instrumentation-redis==0.52b0",
|
162
174
|
},
|
163
175
|
{
|
164
176
|
"library": "remoulade >= 0.50",
|
165
|
-
"instrumentation": "opentelemetry-instrumentation-remoulade==0.
|
177
|
+
"instrumentation": "opentelemetry-instrumentation-remoulade==0.52b0",
|
166
178
|
},
|
167
179
|
{
|
168
180
|
"library": "requests ~= 2.0",
|
169
|
-
"instrumentation": "opentelemetry-instrumentation-requests==0.
|
181
|
+
"instrumentation": "opentelemetry-instrumentation-requests==0.52b0",
|
170
182
|
},
|
171
183
|
{
|
172
184
|
"library": "sqlalchemy >= 1.0.0, < 2.1.0",
|
173
|
-
"instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.
|
185
|
+
"instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.52b0",
|
174
186
|
},
|
175
187
|
{
|
176
|
-
"library": "starlette
|
177
|
-
"instrumentation": "opentelemetry-instrumentation-starlette==0.
|
188
|
+
"library": "starlette >= 0.13, <0.15",
|
189
|
+
"instrumentation": "opentelemetry-instrumentation-starlette==0.52b0",
|
178
190
|
},
|
179
191
|
{
|
180
192
|
"library": "psutil >= 5",
|
181
|
-
"instrumentation": "opentelemetry-instrumentation-system-metrics==0.
|
193
|
+
"instrumentation": "opentelemetry-instrumentation-system-metrics==0.52b0",
|
182
194
|
},
|
183
195
|
{
|
184
196
|
"library": "tornado >= 5.1.1",
|
185
|
-
"instrumentation": "opentelemetry-instrumentation-tornado==0.
|
197
|
+
"instrumentation": "opentelemetry-instrumentation-tornado==0.52b0",
|
186
198
|
},
|
187
199
|
{
|
188
200
|
"library": "tortoise-orm >= 0.17.0",
|
189
|
-
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.
|
201
|
+
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.52b0",
|
190
202
|
},
|
191
203
|
{
|
192
204
|
"library": "pydantic >= 1.10.2",
|
193
|
-
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.
|
205
|
+
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.52b0",
|
194
206
|
},
|
195
207
|
{
|
196
208
|
"library": "urllib3 >= 1.0.0, < 3.0.0",
|
197
|
-
"instrumentation": "opentelemetry-instrumentation-urllib3==0.
|
209
|
+
"instrumentation": "opentelemetry-instrumentation-urllib3==0.52b0",
|
198
210
|
},
|
199
211
|
]
|
200
212
|
default_instrumentations = [
|
201
|
-
"opentelemetry-instrumentation-asyncio==0.
|
202
|
-
"opentelemetry-instrumentation-dbapi==0.
|
203
|
-
"opentelemetry-instrumentation-logging==0.
|
204
|
-
"opentelemetry-instrumentation-sqlite3==0.
|
205
|
-
"opentelemetry-instrumentation-threading==0.
|
206
|
-
"opentelemetry-instrumentation-urllib==0.
|
207
|
-
"opentelemetry-instrumentation-wsgi==0.
|
213
|
+
"opentelemetry-instrumentation-asyncio==0.52b0",
|
214
|
+
"opentelemetry-instrumentation-dbapi==0.52b0",
|
215
|
+
"opentelemetry-instrumentation-logging==0.52b0",
|
216
|
+
"opentelemetry-instrumentation-sqlite3==0.52b0",
|
217
|
+
"opentelemetry-instrumentation-threading==0.52b0",
|
218
|
+
"opentelemetry-instrumentation-urllib==0.52b0",
|
219
|
+
"opentelemetry-instrumentation-wsgi==0.52b0",
|
208
220
|
]
|
@@ -47,13 +47,14 @@ def get_dist_dependency_conflicts(
|
|
47
47
|
extra = "extra"
|
48
48
|
instruments = "instruments"
|
49
49
|
instruments_marker = {extra: instruments}
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
if dist.requires:
|
51
|
+
for dep in dist.requires:
|
52
|
+
if extra not in dep or instruments not in dep:
|
53
|
+
continue
|
54
|
+
|
55
|
+
req = Requirement(dep)
|
56
|
+
if req.marker.evaluate(instruments_marker):
|
57
|
+
instrumentation_deps.append(req)
|
57
58
|
|
58
59
|
return get_dependency_conflicts(instrumentation_deps)
|
59
60
|
|
@@ -12,11 +12,13 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
from __future__ import annotations
|
16
|
+
|
15
17
|
import urllib.parse
|
16
18
|
from contextlib import contextmanager
|
17
19
|
from importlib import import_module
|
18
20
|
from re import escape, sub
|
19
|
-
from typing import Dict,
|
21
|
+
from typing import Any, Dict, Generator, Sequence
|
20
22
|
|
21
23
|
from wrapt import ObjectProxy
|
22
24
|
|
@@ -44,9 +46,9 @@ _SUPPRESS_INSTRUMENTATION_KEY_PLAIN = (
|
|
44
46
|
|
45
47
|
|
46
48
|
def extract_attributes_from_object(
|
47
|
-
obj:
|
49
|
+
obj: Any, attributes: Sequence[str], existing: Dict[str, str] | None = None
|
48
50
|
) -> Dict[str, str]:
|
49
|
-
extracted = {}
|
51
|
+
extracted: dict[str, str] = {}
|
50
52
|
if existing:
|
51
53
|
extracted.update(existing)
|
52
54
|
for attr in attributes:
|
@@ -81,7 +83,7 @@ def http_status_to_status_code(
|
|
81
83
|
return StatusCode.ERROR
|
82
84
|
|
83
85
|
|
84
|
-
def unwrap(obj:
|
86
|
+
def unwrap(obj: object, attr: str):
|
85
87
|
"""Given a function that was wrapped by wrapt.wrap_function_wrapper, unwrap it
|
86
88
|
|
87
89
|
The object containing the function to unwrap may be passed as dotted module path string.
|
@@ -152,7 +154,7 @@ def _start_internal_or_server_span(
|
|
152
154
|
return span, token
|
153
155
|
|
154
156
|
|
155
|
-
def _url_quote(s) -> str: # pylint: disable=invalid-name
|
157
|
+
def _url_quote(s: Any) -> str: # pylint: disable=invalid-name
|
156
158
|
if not isinstance(s, (str, bytes)):
|
157
159
|
return s
|
158
160
|
quoted = urllib.parse.quote(s)
|
@@ -163,13 +165,13 @@ def _url_quote(s) -> str: # pylint: disable=invalid-name
|
|
163
165
|
return quoted.replace("%", "%%")
|
164
166
|
|
165
167
|
|
166
|
-
def _get_opentelemetry_values() -> dict:
|
168
|
+
def _get_opentelemetry_values() -> dict[str, Any]:
|
167
169
|
"""
|
168
170
|
Return the OpenTelemetry Trace and Span IDs if Span ID is set in the
|
169
171
|
OpenTelemetry execution context.
|
170
172
|
"""
|
171
173
|
# Insert the W3C TraceContext generated
|
172
|
-
_headers = {}
|
174
|
+
_headers: dict[str, Any] = {}
|
173
175
|
propagator.inject(_headers)
|
174
176
|
return _headers
|
175
177
|
|
@@ -196,7 +198,7 @@ def is_http_instrumentation_enabled() -> bool:
|
|
196
198
|
|
197
199
|
|
198
200
|
@contextmanager
|
199
|
-
def _suppress_instrumentation(*keys: str) ->
|
201
|
+
def _suppress_instrumentation(*keys: str) -> Generator[None]:
|
200
202
|
"""Suppress instrumentation within the context."""
|
201
203
|
ctx = context.get_current()
|
202
204
|
for key in keys:
|
@@ -209,7 +211,7 @@ def _suppress_instrumentation(*keys: str) -> Iterable[None]:
|
|
209
211
|
|
210
212
|
|
211
213
|
@contextmanager
|
212
|
-
def suppress_instrumentation() ->
|
214
|
+
def suppress_instrumentation() -> Generator[None]:
|
213
215
|
"""Suppress instrumentation within the context."""
|
214
216
|
with _suppress_instrumentation(
|
215
217
|
_SUPPRESS_INSTRUMENTATION_KEY, _SUPPRESS_INSTRUMENTATION_KEY_PLAIN
|
@@ -218,7 +220,7 @@ def suppress_instrumentation() -> Iterable[None]:
|
|
218
220
|
|
219
221
|
|
220
222
|
@contextmanager
|
221
|
-
def suppress_http_instrumentation() ->
|
223
|
+
def suppress_http_instrumentation() -> Generator[None]:
|
222
224
|
"""Suppress instrumentation within the context."""
|
223
225
|
with _suppress_instrumentation(_SUPPRESS_HTTP_INSTRUMENTATION_KEY):
|
224
226
|
yield
|
@@ -1,10 +1,12 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: opentelemetry-instrumentation
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.52b0
|
4
4
|
Summary: Instrumentation Tools & Auto Instrumentation for OpenTelemetry Python
|
5
5
|
Project-URL: Homepage, https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-instrumentation
|
6
|
+
Project-URL: Repository, https://github.com/open-telemetry/opentelemetry-python-contrib
|
6
7
|
Author-email: OpenTelemetry Authors <cncf-opentelemetry-contributors@lists.cncf.io>
|
7
|
-
License: Apache-2.0
|
8
|
+
License-Expression: Apache-2.0
|
9
|
+
License-File: LICENSE
|
8
10
|
Classifier: Development Status :: 4 - Beta
|
9
11
|
Classifier: Intended Audience :: Developers
|
10
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
@@ -15,9 +17,10 @@ Classifier: Programming Language :: Python :: 3.9
|
|
15
17
|
Classifier: Programming Language :: Python :: 3.10
|
16
18
|
Classifier: Programming Language :: Python :: 3.11
|
17
19
|
Classifier: Programming Language :: Python :: 3.12
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
18
21
|
Requires-Python: >=3.8
|
19
22
|
Requires-Dist: opentelemetry-api~=1.4
|
20
|
-
Requires-Dist: opentelemetry-semantic-conventions==0.
|
23
|
+
Requires-Dist: opentelemetry-semantic-conventions==0.52b0
|
21
24
|
Requires-Dist: packaging>=18.0
|
22
25
|
Requires-Dist: wrapt<2.0.0,>=1.0.0
|
23
26
|
Description-Content-Type: text/x-rst
|
@@ -154,6 +157,19 @@ start celery with the rest of the arguments.
|
|
154
157
|
The above command will configure the global trace provider to use the Random IDs Generator, and then
|
155
158
|
pass ``--port=3000`` to ``flask run``.
|
156
159
|
|
160
|
+
Programmatic Auto-instrumentation
|
161
|
+
---------------------------------
|
162
|
+
|
163
|
+
::
|
164
|
+
|
165
|
+
from opentelemetry.instrumentation import auto_instrumentation
|
166
|
+
auto_instrumentation.initialize()
|
167
|
+
|
168
|
+
|
169
|
+
If you are in an environment where you cannot use opentelemetry-instrument to inject auto-instrumentation you can do so programmatically with
|
170
|
+
the code above. Please note that some instrumentations may require the ``initialize()`` method to be called before the library they
|
171
|
+
instrument is imported.
|
172
|
+
|
157
173
|
References
|
158
174
|
----------
|
159
175
|
|
@@ -1,20 +1,20 @@
|
|
1
|
-
opentelemetry/instrumentation/_semconv.py,sha256=
|
1
|
+
opentelemetry/instrumentation/_semconv.py,sha256=AD7Yc_q7Fm4bbxS2l6OadfCQtF4murmrzC-BOfJm5Vk,14913
|
2
2
|
opentelemetry/instrumentation/bootstrap.py,sha256=Q-1j1G7QKXTTvH5xGGGRX3jCpTf_NuhBoy2X_MvM9sg,5428
|
3
|
-
opentelemetry/instrumentation/bootstrap_gen.py,sha256=
|
4
|
-
opentelemetry/instrumentation/dependencies.py,sha256=
|
3
|
+
opentelemetry/instrumentation/bootstrap_gen.py,sha256=MiOnnPbE3CoakyP197WzsGhDAGhhp9VDvBH_vzOL2eQ,7504
|
4
|
+
opentelemetry/instrumentation/dependencies.py,sha256=OpZBPaAvxJX8tlftqrsVxyQZkCa9uDgfzA2DA0SO_To,2610
|
5
5
|
opentelemetry/instrumentation/distro.py,sha256=l7wjM9eR44X-Bk6w-b3_kW3_QgW82OiITRTOY48shZk,2168
|
6
6
|
opentelemetry/instrumentation/environment_variables.py,sha256=oRcbNSSbnqJMQ3r4gBhK6jqtuI5WizapP962Z8DrVZ8,905
|
7
7
|
opentelemetry/instrumentation/instrumentor.py,sha256=X5UkWHebXgNBwyrZaHQk-sufWfktrkymkkyzPiel7VY,4558
|
8
8
|
opentelemetry/instrumentation/propagators.py,sha256=hBkG70KlMUiTjxPeiyOhkb_eE96DRVzRyY4fEIzMqD4,4070
|
9
9
|
opentelemetry/instrumentation/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
opentelemetry/instrumentation/sqlcommenter_utils.py,sha256=yV_-hcwy_3ckP76_FC2dOrd8IKi9z_9s980ZMuGYkrE,1960
|
11
|
-
opentelemetry/instrumentation/utils.py,sha256
|
12
|
-
opentelemetry/instrumentation/version.py,sha256=
|
13
|
-
opentelemetry/instrumentation/auto_instrumentation/__init__.py,sha256=
|
11
|
+
opentelemetry/instrumentation/utils.py,sha256=-_D9pwXqGGsq6yUuj88TV7GpaYeatPWDpSmpf-nKpFQ,7117
|
12
|
+
opentelemetry/instrumentation/version.py,sha256=8ybzJrIcr5CRW9fxlL7vXcvj3IIncnVl6eHpEEIxEYk,608
|
13
|
+
opentelemetry/instrumentation/auto_instrumentation/__init__.py,sha256=POBH-53aBJ_y9-kk95Kcst9tf2gOcnhWM-Cue-QXvgY,4637
|
14
14
|
opentelemetry/instrumentation/auto_instrumentation/_load.py,sha256=e3IlquYKHgLuZXZ9pjMg76yxiM0Qa_-6qxgPFL-Vmh0,6301
|
15
|
-
opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py,sha256=
|
16
|
-
opentelemetry_instrumentation-0.
|
17
|
-
opentelemetry_instrumentation-0.
|
18
|
-
opentelemetry_instrumentation-0.
|
19
|
-
opentelemetry_instrumentation-0.
|
20
|
-
opentelemetry_instrumentation-0.
|
15
|
+
opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py,sha256=3c-4MTChVWO-PpdQLpIHPp0M9pZDqnPEEN-jch6v4mU,673
|
16
|
+
opentelemetry_instrumentation-0.52b0.dist-info/METADATA,sha256=Ao9X6xKBsaFT7zqSqr2eRtqNRfnoNhGLaJ0ohh-mMDo,6798
|
17
|
+
opentelemetry_instrumentation-0.52b0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
18
|
+
opentelemetry_instrumentation-0.52b0.dist-info/entry_points.txt,sha256=iVv3t5REB0O58tFUEQQXYLrTCa1VVOFUXfrbvUk6_aU,279
|
19
|
+
opentelemetry_instrumentation-0.52b0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
20
|
+
opentelemetry_instrumentation-0.52b0.dist-info/RECORD,,
|
File without changes
|
File without changes
|