nucliadb-telemetry 6.3.1.post3524__py3-none-any.whl → 6.3.1.post3531__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.

Potentially problematic release.


This version of nucliadb-telemetry might be problematic. Click here for more details.

@@ -28,7 +28,7 @@ from starlette.status import HTTP_500_INTERNAL_SERVER_ERROR
28
28
  from .utils import get_path_template
29
29
 
30
30
  try:
31
- from starlette_prometheus.middleware import (
31
+ from starlette_prometheus.middleware import ( # type: ignore
32
32
  EXCEPTIONS,
33
33
  REQUESTS,
34
34
  REQUESTS_IN_PROGRESS,
@@ -19,13 +19,12 @@
19
19
 
20
20
  from datetime import datetime
21
21
  from functools import partial
22
- from typing import Any, Callable, Dict, List, Optional
22
+ from typing import Any, Callable, Dict, List, Optional, Union
23
23
 
24
24
  import nats
25
25
  from nats.aio.client import Client
26
26
  from nats.aio.msg import Msg
27
27
  from nats.js.client import JetStreamContext
28
- from opentelemetry.context import attach
29
28
  from opentelemetry.propagate import extract, inject
30
29
  from opentelemetry.sdk.trace import TracerProvider
31
30
  from opentelemetry.semconv.trace import SpanAttributes
@@ -63,7 +62,7 @@ msg_sent_counter = metrics.Counter("nuclia_nats_msg_sent", labels={"subject": ""
63
62
 
64
63
 
65
64
  def start_span_message_receiver(tracer: Tracer, msg: Msg):
66
- attributes = {
65
+ attributes: dict[str, Union[str, int]] = {
67
66
  SpanAttributes.MESSAGING_DESTINATION_KIND: "nats",
68
67
  SpanAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES: len(msg.data),
69
68
  SpanAttributes.MESSAGING_MESSAGE_ID: msg.reply,
@@ -71,14 +70,14 @@ def start_span_message_receiver(tracer: Tracer, msg: Msg):
71
70
 
72
71
  # add some attributes from the metadata
73
72
  ctx = extract(msg.headers)
74
- token = attach(ctx)
75
73
 
76
- span = tracer.start_as_current_span( # type: ignore
74
+ span = tracer.start_as_current_span(
77
75
  name=f"Received from {msg.subject}",
76
+ context=ctx,
78
77
  kind=SpanKind.SERVER,
79
78
  attributes=attributes,
80
79
  )
81
- span._token = token
80
+
82
81
  return span
83
82
 
84
83
 
@@ -249,15 +248,13 @@ class NatsClientTelemetry:
249
248
 
250
249
  with start_span_message_publisher(tracer, subject) as span:
251
250
  try:
252
- result = await self.nc.publish(subject, body, headers=headers, **kwargs)
251
+ await self.nc.publish(subject, body, headers=headers, **kwargs)
253
252
  msg_sent_counter.inc({"subject": subject, "status": metrics.OK})
254
253
  except Exception as error:
255
254
  set_span_exception(span, error)
256
255
  msg_sent_counter.inc({"subject": subject, "status": metrics.ERROR})
257
256
  raise error
258
257
 
259
- return result
260
-
261
258
  async def request(
262
259
  self,
263
260
  subject: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nucliadb_telemetry
3
- Version: 6.3.1.post3524
3
+ Version: 6.3.1.post3531
4
4
  Summary: NucliaDB Telemetry Library Python process
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License: AGPL
@@ -7,7 +7,7 @@ nucliadb_telemetry/grpc.py,sha256=1CdueeJedxManSUQKwNOvqUuFiVhnMiZViXUJm81bIY,14
7
7
  nucliadb_telemetry/grpc_metrics.py,sha256=L2XMcJDxioNUYPX_IbKl_zvrG8uOFpF_a67c6yJq-Jw,5174
8
8
  nucliadb_telemetry/grpc_sentry.py,sha256=3eS_DVIX5MzvbJBkykf8JyZUf1b_b9w1KLhjoiW7oV0,2659
9
9
  nucliadb_telemetry/jaeger.py,sha256=HMQK8x_oaol5tCx3hCjaMG5Uzvsy_WWhKnD-FEZoYA4,7036
10
- nucliadb_telemetry/jetstream.py,sha256=9oMAAqtBrER7ISz8Jm2tbuVWCxQgfqLdHy3VraVFnIg,10057
10
+ nucliadb_telemetry/jetstream.py,sha256=E2_SY5-8ljhZAY0n_q-qlvewUmi2kF2En3mcqyA26kY,9977
11
11
  nucliadb_telemetry/logs.py,sha256=ag1e7tKEoNFgB1FuAmyTxdIHtTFwOJlGxPl2s1bhUic,9311
12
12
  nucliadb_telemetry/metrics.py,sha256=jSGecUI7qNbPm3OEzo11v4Zo-lUhXhZrhkWPtX1eGf8,8022
13
13
  nucliadb_telemetry/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -16,7 +16,7 @@ nucliadb_telemetry/tracerprovider.py,sha256=ycVqSMo0NTa7EEv4QLC8qAt0NYKbOy8uC9k1
16
16
  nucliadb_telemetry/utils.py,sha256=lqbW5SjpGcfEhiJUScYeaNrtt5BFnOTaJn5dwnjCVMM,4765
17
17
  nucliadb_telemetry/fastapi/__init__.py,sha256=NRtQtyE1jZzTK5bZETYqb0d6bpjthTAt-UXiO8DAQWQ,3716
18
18
  nucliadb_telemetry/fastapi/context.py,sha256=qhl3rVDtqDfnsCHBAlv-eX8SUSlooMnsryBcV5FMZvU,1530
19
- nucliadb_telemetry/fastapi/metrics.py,sha256=15GDaTNslQ00AZEAZvQFC8OyVIKdKLjzhafnWbsfytw,3906
19
+ nucliadb_telemetry/fastapi/metrics.py,sha256=fcnT5ShmU3oHci2FNJPoyYwWJiP60O0G3CEUAzUsC1w,3922
20
20
  nucliadb_telemetry/fastapi/tracing.py,sha256=U85I3QIFb27aj4v3Cl6l5evEgskP12LuEXW4pAsvGCc,15052
21
21
  nucliadb_telemetry/fastapi/utils.py,sha256=HtfhBSaYs_HWHx7SBp0pPAsoig5CLcHNFIFnzb-RXOE,2979
22
22
  nucliadb_telemetry/tests/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
@@ -30,7 +30,7 @@ nucliadb_telemetry/tests/grpc/helloworld_pb2.py,sha256=ht4dmi0pAy6qDrwcjkbtSf_hO
30
30
  nucliadb_telemetry/tests/grpc/helloworld_pb2.pyi,sha256=mBZCQE6z7riQw6fOegJgZ5lHmXqO23_zxL8iQMqSqms,1191
31
31
  nucliadb_telemetry/tests/grpc/helloworld_pb2_grpc.py,sha256=_jxUNxl4Fx-JztK9RO5R6osjNP2sVNVPAxLnmczEYOc,2677
32
32
  nucliadb_telemetry/tests/grpc/helloworld_pb2_grpc.pyi,sha256=Y6teCx-PhPU-rI6w5ItLBKaTb34FLpngPnuDVWtNve4,958
33
- nucliadb_telemetry-6.3.1.post3524.dist-info/METADATA,sha256=oFbESFZg31EEhSRJXAHBKeiWX0uGpH6AXwCPKdK7438,10640
34
- nucliadb_telemetry-6.3.1.post3524.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
35
- nucliadb_telemetry-6.3.1.post3524.dist-info/top_level.txt,sha256=3qEHI_5ttqQIL2gkNYwSlKsFyBBiEzDiIy9UKISzOaQ,19
36
- nucliadb_telemetry-6.3.1.post3524.dist-info/RECORD,,
33
+ nucliadb_telemetry-6.3.1.post3531.dist-info/METADATA,sha256=oJ9QQXrQH4HczD3HSSs2li-ykyUv9lH62kRAMUUnexE,10640
34
+ nucliadb_telemetry-6.3.1.post3531.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
35
+ nucliadb_telemetry-6.3.1.post3531.dist-info/top_level.txt,sha256=3qEHI_5ttqQIL2gkNYwSlKsFyBBiEzDiIy9UKISzOaQ,19
36
+ nucliadb_telemetry-6.3.1.post3531.dist-info/RECORD,,