opentelemetry-instrumentation-tornado 0.46b0__py3-none-any.whl → 0.48b0__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.
@@ -296,7 +296,7 @@ def _create_server_histograms(meter) -> Dict[str, Histogram]:
296
296
  MetricInstruments.HTTP_SERVER_DURATION: meter.create_histogram(
297
297
  name=MetricInstruments.HTTP_SERVER_DURATION,
298
298
  unit="ms",
299
- description="Duration of HTTP client requests.",
299
+ description="Duration of HTTP server requests.",
300
300
  ),
301
301
  MetricInstruments.HTTP_SERVER_REQUEST_SIZE: meter.create_histogram(
302
302
  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
- if span.is_recording() and exc:
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
- description = f"{type(exc).__name__}: {exc}"
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
- span.set_status(
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
- metric_attributes = _create_metric_attributes(response)
131
- request_size = int(response.request.headers.get("Content-Length", 0))
132
- response_size = int(response.headers.get("Content-Length", 0))
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
- duration_histogram.record(
135
- response.request_time, attributes=metric_attributes
136
- )
137
- request_size_histogram.record(request_size, attributes=metric_attributes)
138
- response_size_histogram.record(response_size, attributes=metric_attributes)
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)
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "0.46b0"
15
+ __version__ = "0.48b0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: opentelemetry-instrumentation-tornado
3
- Version: 0.46b0
3
+ Version: 0.48b0
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>
@@ -14,11 +14,12 @@ Classifier: Programming Language :: Python :: 3.8
14
14
  Classifier: Programming Language :: Python :: 3.9
15
15
  Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
17
18
  Requires-Python: >=3.8
18
19
  Requires-Dist: opentelemetry-api~=1.12
19
- Requires-Dist: opentelemetry-instrumentation==0.46b0
20
- Requires-Dist: opentelemetry-semantic-conventions==0.46b0
21
- Requires-Dist: opentelemetry-util-http==0.46b0
20
+ Requires-Dist: opentelemetry-instrumentation==0.48b0
21
+ Requires-Dist: opentelemetry-semantic-conventions==0.48b0
22
+ Requires-Dist: opentelemetry-util-http==0.48b0
22
23
  Provides-Extra: instruments
23
24
  Requires-Dist: tornado>=5.1.1; extra == 'instruments'
24
25
  Description-Content-Type: text/x-rst
@@ -0,0 +1,9 @@
1
+ opentelemetry/instrumentation/tornado/__init__.py,sha256=287JyPXWJfuF7Rdeq_yUypcKXLAJIRnStOflX4jLNng,23139
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=wOX_9uGRBIlLks98mTGJZnnmD1Zez4rGVQNmP23fWEc,608
5
+ opentelemetry_instrumentation_tornado-0.48b0.dist-info/METADATA,sha256=DwyIBBkR4dagRQHeDJMXSV08eh_NF0CWD3a2D84hOWM,1983
6
+ opentelemetry_instrumentation_tornado-0.48b0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
7
+ opentelemetry_instrumentation_tornado-0.48b0.dist-info/entry_points.txt,sha256=oDTErilMYHHuN6bv9XNAU1Avoy8f_nfCx91bASSkpgg,97
8
+ opentelemetry_instrumentation_tornado-0.48b0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
9
+ opentelemetry_instrumentation_tornado-0.48b0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.24.2
2
+ Generator: hatchling 1.25.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,9 +0,0 @@
1
- opentelemetry/instrumentation/tornado/__init__.py,sha256=UrhGSHAvSo90eH7n8hECnhNxtHIyzvLOwK6LaXKFIhU,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=asa7q2ly73330-K1Q7vujpvZk7hfhasEZUzSFDPu1N8,608
5
- opentelemetry_instrumentation_tornado-0.46b0.dist-info/METADATA,sha256=mi34aoPBU8II-lJi7fbVR6fXxbd5zTz3xN8IeQfiNjw,1932
6
- opentelemetry_instrumentation_tornado-0.46b0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
7
- opentelemetry_instrumentation_tornado-0.46b0.dist-info/entry_points.txt,sha256=oDTErilMYHHuN6bv9XNAU1Avoy8f_nfCx91bASSkpgg,97
8
- opentelemetry_instrumentation_tornado-0.46b0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
9
- opentelemetry_instrumentation_tornado-0.46b0.dist-info/RECORD,,