nucliadb-telemetry 6.4.0.post4167__py3-none-any.whl → 6.4.0.post4171__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.
- nucliadb_telemetry/jetstream.py +21 -5
- {nucliadb_telemetry-6.4.0.post4167.dist-info → nucliadb_telemetry-6.4.0.post4171.dist-info}/METADATA +1 -1
- {nucliadb_telemetry-6.4.0.post4167.dist-info → nucliadb_telemetry-6.4.0.post4171.dist-info}/RECORD +5 -5
- {nucliadb_telemetry-6.4.0.post4167.dist-info → nucliadb_telemetry-6.4.0.post4171.dist-info}/WHEEL +0 -0
- {nucliadb_telemetry-6.4.0.post4167.dist-info → nucliadb_telemetry-6.4.0.post4171.dist-info}/top_level.txt +0 -0
nucliadb_telemetry/jetstream.py
CHANGED
|
@@ -19,12 +19,13 @@
|
|
|
19
19
|
|
|
20
20
|
from datetime import datetime
|
|
21
21
|
from functools import partial
|
|
22
|
-
from typing import Any, Callable, Dict, List, Optional, Union
|
|
22
|
+
from typing import Any, Awaitable, Callable, Dict, List, Optional, Union
|
|
23
23
|
from urllib.parse import ParseResult
|
|
24
24
|
|
|
25
25
|
import nats
|
|
26
26
|
from nats.aio.client import Client
|
|
27
27
|
from nats.aio.msg import Msg
|
|
28
|
+
from nats.aio.subscription import Subscription
|
|
28
29
|
from nats.js.client import JetStreamContext
|
|
29
30
|
from opentelemetry.propagate import extract, inject
|
|
30
31
|
from opentelemetry.sdk.trace import TracerProvider
|
|
@@ -109,7 +110,13 @@ class JetStreamContextTelemetry:
|
|
|
109
110
|
async def add_stream(self, name: str, subjects: List[str]):
|
|
110
111
|
return await self.js.add_stream(name=name, subjects=subjects)
|
|
111
112
|
|
|
112
|
-
async def subscribe(
|
|
113
|
+
async def subscribe(
|
|
114
|
+
self,
|
|
115
|
+
subject: str,
|
|
116
|
+
queue: Optional[str] = None,
|
|
117
|
+
cb: Optional[Callable[[Msg], Awaitable[None]]] = None,
|
|
118
|
+
**kwargs,
|
|
119
|
+
):
|
|
113
120
|
tracer = self.tracer_provider.get_tracer(f"{self.service_name}_js_subscriber")
|
|
114
121
|
|
|
115
122
|
async def wrapper(origin_cb, tracer, msg: Msg):
|
|
@@ -136,7 +143,7 @@ class JetStreamContextTelemetry:
|
|
|
136
143
|
)
|
|
137
144
|
|
|
138
145
|
wrapped_cb = partial(wrapper, cb, tracer)
|
|
139
|
-
return await self.js.subscribe(cb=wrapped_cb, **kwargs)
|
|
146
|
+
return await self.js.subscribe(subject, queue=queue, cb=wrapped_cb, **kwargs)
|
|
140
147
|
|
|
141
148
|
async def publish(
|
|
142
149
|
self,
|
|
@@ -217,7 +224,13 @@ class NatsClientTelemetry:
|
|
|
217
224
|
self.service_name = service_name
|
|
218
225
|
self.tracer_provider = tracer_provider
|
|
219
226
|
|
|
220
|
-
async def subscribe(
|
|
227
|
+
async def subscribe(
|
|
228
|
+
self,
|
|
229
|
+
subject: str,
|
|
230
|
+
queue: str = "",
|
|
231
|
+
cb: Optional[Callable[[Msg], Awaitable[None]]] = None,
|
|
232
|
+
**kwargs,
|
|
233
|
+
) -> Subscription:
|
|
221
234
|
tracer = self.tracer_provider.get_tracer(f"{self.service_name}_nc_subscriber")
|
|
222
235
|
|
|
223
236
|
async def wrapper(origin_cb, tracer, msg: Msg):
|
|
@@ -235,7 +248,7 @@ class NatsClientTelemetry:
|
|
|
235
248
|
raise error
|
|
236
249
|
|
|
237
250
|
wrapped_cb = partial(wrapper, cb, tracer)
|
|
238
|
-
return await self.nc.subscribe(cb=wrapped_cb, **kwargs)
|
|
251
|
+
return await self.nc.subscribe(subject, queue=queue, cb=wrapped_cb, **kwargs)
|
|
239
252
|
|
|
240
253
|
async def publish(
|
|
241
254
|
self,
|
|
@@ -290,6 +303,9 @@ class NatsClientTelemetry:
|
|
|
290
303
|
def jetstream(self, **opts) -> nats.js.JetStreamContext:
|
|
291
304
|
return self.nc.jetstream(**opts)
|
|
292
305
|
|
|
306
|
+
def jsm(self, **opts) -> nats.js.JetStreamManager:
|
|
307
|
+
return self.nc.jsm(**opts)
|
|
308
|
+
|
|
293
309
|
async def drain(self) -> None:
|
|
294
310
|
return await self.nc.drain()
|
|
295
311
|
|
{nucliadb_telemetry-6.4.0.post4167.dist-info → nucliadb_telemetry-6.4.0.post4171.dist-info}/RECORD
RENAMED
|
@@ -7,7 +7,7 @@ nucliadb_telemetry/grpc.py,sha256=cNJRJLr0aRedKr5V_ufGqeidnMlBouML3QbFKkugTqg,15
|
|
|
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=
|
|
10
|
+
nucliadb_telemetry/jetstream.py,sha256=w6CLN_oGmQT0FgfMmQdtrASsEw5mCk3KW8TwaWCEl-E,11971
|
|
11
11
|
nucliadb_telemetry/logs.py,sha256=ag1e7tKEoNFgB1FuAmyTxdIHtTFwOJlGxPl2s1bhUic,9311
|
|
12
12
|
nucliadb_telemetry/metrics.py,sha256=euexqkmlZip6QFbMfvJW1fSuha96J4ZHnMWixeVJnAs,8652
|
|
13
13
|
nucliadb_telemetry/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -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.4.0.
|
|
34
|
-
nucliadb_telemetry-6.4.0.
|
|
35
|
-
nucliadb_telemetry-6.4.0.
|
|
36
|
-
nucliadb_telemetry-6.4.0.
|
|
33
|
+
nucliadb_telemetry-6.4.0.post4171.dist-info/METADATA,sha256=K1Paf3JNS3nY907ZhPn1BZ3EiVDURjsEdLmyNeoSVFk,11057
|
|
34
|
+
nucliadb_telemetry-6.4.0.post4171.dist-info/WHEEL,sha256=ooBFpIzZCPdw3uqIQsOo4qqbA4ZRPxHnOH7peeONza0,91
|
|
35
|
+
nucliadb_telemetry-6.4.0.post4171.dist-info/top_level.txt,sha256=3qEHI_5ttqQIL2gkNYwSlKsFyBBiEzDiIy9UKISzOaQ,19
|
|
36
|
+
nucliadb_telemetry-6.4.0.post4171.dist-info/RECORD,,
|
{nucliadb_telemetry-6.4.0.post4167.dist-info → nucliadb_telemetry-6.4.0.post4171.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|