opentelemetry-instrumentation-tornado 0.56b0__py3-none-any.whl → 0.58b0__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.
@@ -211,6 +211,7 @@ from .client import fetch_async # pylint: disable=E0401
211
211
 
212
212
  _logger = getLogger(__name__)
213
213
  _TraceContext = namedtuple("TraceContext", ["activation", "span", "token"])
214
+ _HANDLER_STATE_KEY = "_otel_state_key"
214
215
  _HANDLER_CONTEXT_KEY = "_otel_trace_context_key"
215
216
  _OTEL_PATCHED_KEY = "_otel_patched_key"
216
217
 
@@ -402,10 +403,14 @@ def _wrap(cls, method_name, wrapper):
402
403
  def _prepare(
403
404
  tracer, server_histograms, request_hook, func, handler, args, kwargs
404
405
  ):
405
- server_histograms[_START_TIME] = default_timer()
406
-
407
406
  request = handler.request
408
- if _excluded_urls.url_disabled(request.uri):
407
+ otel_handler_state = {
408
+ _START_TIME: default_timer(),
409
+ "exclude_request": _excluded_urls.url_disabled(request.uri),
410
+ }
411
+ setattr(handler, _HANDLER_STATE_KEY, otel_handler_state)
412
+
413
+ if otel_handler_state["exclude_request"]:
409
414
  return func(*args, **kwargs)
410
415
 
411
416
  _record_prepare_metrics(server_histograms, handler)
@@ -622,9 +627,11 @@ def _record_prepare_metrics(server_histograms, handler):
622
627
 
623
628
 
624
629
  def _record_on_finish_metrics(server_histograms, handler, error=None):
625
- elapsed_time = round(
626
- (default_timer() - server_histograms[_START_TIME]) * 1000
627
- )
630
+ otel_handler_state = getattr(handler, _HANDLER_STATE_KEY, None) or {}
631
+ if otel_handler_state.get("exclude_request"):
632
+ return
633
+ start_time = otel_handler_state.get(_START_TIME, None) or default_timer()
634
+ elapsed_time = round((default_timer() - start_time) * 1000)
628
635
 
629
636
  response_size = int(handler._headers.get("Content-Length", 0))
630
637
  metric_attributes = _create_metric_attributes(handler)
@@ -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.56b0"
15
+ __version__ = "0.58b0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opentelemetry-instrumentation-tornado
3
- Version: 0.56b0
3
+ Version: 0.58b0
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
  Project-URL: Repository, https://github.com/open-telemetry/opentelemetry-python-contrib
@@ -18,9 +18,9 @@ Classifier: Programming Language :: Python :: 3.12
18
18
  Classifier: Programming Language :: Python :: 3.13
19
19
  Requires-Python: >=3.9
20
20
  Requires-Dist: opentelemetry-api~=1.12
21
- Requires-Dist: opentelemetry-instrumentation==0.56b0
22
- Requires-Dist: opentelemetry-semantic-conventions==0.56b0
23
- Requires-Dist: opentelemetry-util-http==0.56b0
21
+ Requires-Dist: opentelemetry-instrumentation==0.58b0
22
+ Requires-Dist: opentelemetry-semantic-conventions==0.58b0
23
+ Requires-Dist: opentelemetry-util-http==0.58b0
24
24
  Provides-Extra: instruments
25
25
  Requires-Dist: tornado>=5.1.1; extra == 'instruments'
26
26
  Description-Content-Type: text/x-rst
@@ -0,0 +1,9 @@
1
+ opentelemetry/instrumentation/tornado/__init__.py,sha256=ZqVu0ir979myAwk_8AS1msG5GRRUbroD0-jCrqKqvVA,24181
2
+ opentelemetry/instrumentation/tornado/client.py,sha256=owjoJurMaTaW3u8MGbuScAPKKtbqm-tkzY8O1eoasPQ,5031
3
+ opentelemetry/instrumentation/tornado/package.py,sha256=mv-OUOrDF54kFoP_Epb3Pv8aufliZTMOwLWL5oAV_hY,649
4
+ opentelemetry/instrumentation/tornado/version.py,sha256=ffP-oEEHLyxQqazhPgp7CuNbVtp_sjb1Mo2_zNZb-QU,608
5
+ opentelemetry_instrumentation_tornado-0.58b0.dist-info/METADATA,sha256=ijqazr9fO-cALRWcuoHto6FSDJqPwQDXNLkz3ygAKoI,2072
6
+ opentelemetry_instrumentation_tornado-0.58b0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ opentelemetry_instrumentation_tornado-0.58b0.dist-info/entry_points.txt,sha256=oDTErilMYHHuN6bv9XNAU1Avoy8f_nfCx91bASSkpgg,97
8
+ opentelemetry_instrumentation_tornado-0.58b0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
9
+ opentelemetry_instrumentation_tornado-0.58b0.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- opentelemetry/instrumentation/tornado/__init__.py,sha256=Xo2NCi1_C4J9wK3U1EI1gNNlNPsUJDFlu97FSnjTh2I,23814
2
- opentelemetry/instrumentation/tornado/client.py,sha256=owjoJurMaTaW3u8MGbuScAPKKtbqm-tkzY8O1eoasPQ,5031
3
- opentelemetry/instrumentation/tornado/package.py,sha256=mv-OUOrDF54kFoP_Epb3Pv8aufliZTMOwLWL5oAV_hY,649
4
- opentelemetry/instrumentation/tornado/version.py,sha256=Lt3ez1q5jzk4LG8aTMzoNp4bUxxWBqofY7vWXcRBByA,608
5
- opentelemetry_instrumentation_tornado-0.56b0.dist-info/METADATA,sha256=Ae8-OpWuHMP9SOLyiHgbDKKSVK7lMNvsC_tUde_1q0Q,2072
6
- opentelemetry_instrumentation_tornado-0.56b0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- opentelemetry_instrumentation_tornado-0.56b0.dist-info/entry_points.txt,sha256=oDTErilMYHHuN6bv9XNAU1Avoy8f_nfCx91bASSkpgg,97
8
- opentelemetry_instrumentation_tornado-0.56b0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
9
- opentelemetry_instrumentation_tornado-0.56b0.dist-info/RECORD,,