opentelemetry-instrumentation-tornado 0.47b0__py3-none-any.whl → 0.49b0__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/tornado/__init__.py +1 -2
- opentelemetry/instrumentation/tornado/client.py +36 -20
- opentelemetry/instrumentation/tornado/version.py +1 -1
- {opentelemetry_instrumentation_tornado-0.47b0.dist-info → opentelemetry_instrumentation_tornado-0.49b0.dist-info}/METADATA +4 -4
- opentelemetry_instrumentation_tornado-0.49b0.dist-info/RECORD +9 -0
- opentelemetry_instrumentation_tornado-0.47b0.dist-info/RECORD +0 -9
- {opentelemetry_instrumentation_tornado-0.47b0.dist-info → opentelemetry_instrumentation_tornado-0.49b0.dist-info}/WHEEL +0 -0
- {opentelemetry_instrumentation_tornado-0.47b0.dist-info → opentelemetry_instrumentation_tornado-0.49b0.dist-info}/entry_points.txt +0 -0
- {opentelemetry_instrumentation_tornado-0.47b0.dist-info → opentelemetry_instrumentation_tornado-0.49b0.dist-info}/licenses/LICENSE +0 -0
@@ -152,7 +152,6 @@ API
|
|
152
152
|
---
|
153
153
|
"""
|
154
154
|
|
155
|
-
|
156
155
|
from collections import namedtuple
|
157
156
|
from functools import partial
|
158
157
|
from logging import getLogger
|
@@ -296,7 +295,7 @@ def _create_server_histograms(meter) -> Dict[str, Histogram]:
|
|
296
295
|
MetricInstruments.HTTP_SERVER_DURATION: meter.create_histogram(
|
297
296
|
name=MetricInstruments.HTTP_SERVER_DURATION,
|
298
297
|
unit="ms",
|
299
|
-
description="
|
298
|
+
description="Measures the duration of inbound HTTP requests.",
|
300
299
|
),
|
301
300
|
MetricInstruments.HTTP_SERVER_REQUEST_SIZE: meter.create_histogram(
|
302
301
|
name=MetricInstruments.HTTP_SERVER_REQUEST_SIZE,
|
@@ -21,7 +21,7 @@ from opentelemetry import trace
|
|
21
21
|
from opentelemetry.instrumentation.utils import http_status_to_status_code
|
22
22
|
from opentelemetry.propagate import inject
|
23
23
|
from opentelemetry.semconv.trace import SpanAttributes
|
24
|
-
from opentelemetry.trace.status import Status
|
24
|
+
from opentelemetry.trace.status import Status, StatusCode
|
25
25
|
from opentelemetry.util.http import remove_url_credentials
|
26
26
|
|
27
27
|
|
@@ -105,37 +105,53 @@ def _finish_tracing_callback(
|
|
105
105
|
request_size_histogram,
|
106
106
|
response_size_histogram,
|
107
107
|
):
|
108
|
+
response = None
|
108
109
|
status_code = None
|
110
|
+
status = None
|
109
111
|
description = None
|
110
|
-
exc = future.exception()
|
111
|
-
|
112
|
-
response = future.result()
|
113
112
|
|
114
|
-
|
113
|
+
exc = future.exception()
|
114
|
+
if exc:
|
115
|
+
description = f"{type(exc).__qualname__}: {exc}"
|
115
116
|
if isinstance(exc, HTTPError):
|
117
|
+
response = exc.response
|
116
118
|
status_code = exc.code
|
117
|
-
|
119
|
+
status = Status(
|
120
|
+
status_code=http_status_to_status_code(status_code),
|
121
|
+
description=description,
|
122
|
+
)
|
123
|
+
else:
|
124
|
+
status = Status(
|
125
|
+
status_code=StatusCode.ERROR,
|
126
|
+
description=description,
|
127
|
+
)
|
128
|
+
span.record_exception(exc)
|
118
129
|
else:
|
130
|
+
response = future.result()
|
119
131
|
status_code = response.code
|
132
|
+
status = Status(
|
133
|
+
status_code=http_status_to_status_code(status_code),
|
134
|
+
description=description,
|
135
|
+
)
|
120
136
|
|
121
137
|
if status_code is not None:
|
122
138
|
span.set_attribute(SpanAttributes.HTTP_STATUS_CODE, status_code)
|
123
|
-
|
124
|
-
Status(
|
125
|
-
status_code=http_status_to_status_code(status_code),
|
126
|
-
description=description,
|
127
|
-
)
|
128
|
-
)
|
139
|
+
span.set_status(status)
|
129
140
|
|
130
|
-
|
131
|
-
|
132
|
-
|
141
|
+
if response is not None:
|
142
|
+
metric_attributes = _create_metric_attributes(response)
|
143
|
+
request_size = int(response.request.headers.get("Content-Length", 0))
|
144
|
+
response_size = int(response.headers.get("Content-Length", 0))
|
133
145
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
146
|
+
duration_histogram.record(
|
147
|
+
response.request_time, attributes=metric_attributes
|
148
|
+
)
|
149
|
+
request_size_histogram.record(
|
150
|
+
request_size, attributes=metric_attributes
|
151
|
+
)
|
152
|
+
response_size_histogram.record(
|
153
|
+
response_size, attributes=metric_attributes
|
154
|
+
)
|
139
155
|
|
140
156
|
if response_hook:
|
141
157
|
response_hook(span, future)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: opentelemetry-instrumentation-tornado
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.49b0
|
4
4
|
Summary: Tornado instrumentation for OpenTelemetry
|
5
5
|
Project-URL: Homepage, https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-tornado
|
6
6
|
Author-email: OpenTelemetry Authors <cncf-opentelemetry-contributors@lists.cncf.io>
|
@@ -17,9 +17,9 @@ Classifier: Programming Language :: Python :: 3.11
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.12
|
18
18
|
Requires-Python: >=3.8
|
19
19
|
Requires-Dist: opentelemetry-api~=1.12
|
20
|
-
Requires-Dist: opentelemetry-instrumentation==0.
|
21
|
-
Requires-Dist: opentelemetry-semantic-conventions==0.
|
22
|
-
Requires-Dist: opentelemetry-util-http==0.
|
20
|
+
Requires-Dist: opentelemetry-instrumentation==0.49b0
|
21
|
+
Requires-Dist: opentelemetry-semantic-conventions==0.49b0
|
22
|
+
Requires-Dist: opentelemetry-util-http==0.49b0
|
23
23
|
Provides-Extra: instruments
|
24
24
|
Requires-Dist: tornado>=5.1.1; extra == 'instruments'
|
25
25
|
Description-Content-Type: text/x-rst
|
@@ -0,0 +1,9 @@
|
|
1
|
+
opentelemetry/instrumentation/tornado/__init__.py,sha256=ThI0T3n3WNLWtXW-6VkDYQ00xPv1E-mcggFlsXdfK7M,23152
|
2
|
+
opentelemetry/instrumentation/tornado/client.py,sha256=GmCilVnjXQAyXqGDAZsTT8CDhVTmRtczXgFzYLmpMto,5082
|
3
|
+
opentelemetry/instrumentation/tornado/package.py,sha256=mv-OUOrDF54kFoP_Epb3Pv8aufliZTMOwLWL5oAV_hY,649
|
4
|
+
opentelemetry/instrumentation/tornado/version.py,sha256=feu1cU-5Mlc3KHErNko0hTd8PObq7lIudxaIp9B3L_8,608
|
5
|
+
opentelemetry_instrumentation_tornado-0.49b0.dist-info/METADATA,sha256=aLwfl5UkO7eE4W4MW4Fm0OoaY5AzdhFVijc-D83pNJA,1983
|
6
|
+
opentelemetry_instrumentation_tornado-0.49b0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
7
|
+
opentelemetry_instrumentation_tornado-0.49b0.dist-info/entry_points.txt,sha256=oDTErilMYHHuN6bv9XNAU1Avoy8f_nfCx91bASSkpgg,97
|
8
|
+
opentelemetry_instrumentation_tornado-0.49b0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
9
|
+
opentelemetry_instrumentation_tornado-0.49b0.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
opentelemetry/instrumentation/tornado/__init__.py,sha256=287JyPXWJfuF7Rdeq_yUypcKXLAJIRnStOflX4jLNng,23139
|
2
|
-
opentelemetry/instrumentation/tornado/client.py,sha256=xWNwdEjukG19jNTrfi4Rw8lS6rcRW3_RqOVTbXlTL2E,4586
|
3
|
-
opentelemetry/instrumentation/tornado/package.py,sha256=mv-OUOrDF54kFoP_Epb3Pv8aufliZTMOwLWL5oAV_hY,649
|
4
|
-
opentelemetry/instrumentation/tornado/version.py,sha256=6FmWdr2KRW0MGpqEO5NBzLrm6URCtz_6ixXi_ALh6JA,608
|
5
|
-
opentelemetry_instrumentation_tornado-0.47b0.dist-info/METADATA,sha256=W0BjBwrIAGrIzt9bKsYScrmsJWU1YqjeK9M70Gw962g,1983
|
6
|
-
opentelemetry_instrumentation_tornado-0.47b0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
7
|
-
opentelemetry_instrumentation_tornado-0.47b0.dist-info/entry_points.txt,sha256=oDTErilMYHHuN6bv9XNAU1Avoy8f_nfCx91bASSkpgg,97
|
8
|
-
opentelemetry_instrumentation_tornado-0.47b0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
9
|
-
opentelemetry_instrumentation_tornado-0.47b0.dist-info/RECORD,,
|
File without changes
|
File without changes
|