nucliadb-telemetry 5.2.1.post1869__py3-none-any.whl → 5.2.1.post1873__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.
@@ -16,13 +16,16 @@
16
16
  #
17
17
  # You should have received a copy of the GNU Affero General Public License
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ from starlette.middleware.base import BaseHTTPMiddleware, RequestResponseEndpoint
20
+ from starlette.requests import Request
21
+ from starlette.responses import Response
19
22
 
20
23
  from nucliadb_telemetry import context
21
24
 
22
25
  from .utils import get_path_template
23
26
 
24
27
 
25
- class ContextInjectorMiddleware:
28
+ class ContextInjectorMiddleware(BaseHTTPMiddleware):
26
29
  """
27
30
  Automatically inject context values for the current request's path parameters
28
31
 
@@ -30,13 +33,9 @@ class ContextInjectorMiddleware:
30
33
  - `/api/v1/kb/{kbid}` would inject a context value for `kbid`
31
34
  """
32
35
 
33
- def __init__(self, app):
34
- self.app = app
36
+ async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response:
37
+ found_path_template = get_path_template(request.scope)
38
+ if found_path_template.match:
39
+ context.add_context(found_path_template.scope.get("path_params", {})) # type: ignore
35
40
 
36
- async def __call__(self, scope, receive, send):
37
- if scope["type"] == "http":
38
- found_path_template = get_path_template(scope)
39
- if found_path_template.match:
40
- context.add_context(found_path_template.scope.get("path_params", {})) # type: ignore
41
-
42
- return await self.app(scope, receive, send)
41
+ return await call_next(request)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nucliadb_telemetry
3
- Version: 5.2.1.post1869
3
+ Version: 5.2.1.post1873
4
4
  Summary: NucliaDB Telemetry Library Python process
5
5
  Home-page: https://github.com/nuclia/nucliadb
6
6
  Author: nucliadb Authors
@@ -26,24 +26,24 @@ Requires-Dist: prometheus-client>=0.12.0
26
26
  Requires-Dist: orjson>=3.6.7
27
27
  Requires-Dist: wrapt>=1.14.1
28
28
  Provides-Extra: all
29
- Requires-Dist: grpcio-testing<1.63.0,>=1.44.0; extra == "all"
30
- Requires-Dist: grpcio-reflection<1.63.0,>=1.44.0; extra == "all"
29
+ Requires-Dist: grpcio-health-checking<1.63.0,>=1.44.0; extra == "all"
31
30
  Requires-Dist: opentelemetry-instrumentation-fastapi>=0.42b0; extra == "all"
32
- Requires-Dist: grpcio<1.63.0,>=1.44.0; extra == "all"
33
- Requires-Dist: grpcio-channelz<1.63.0,>=1.44.0; extra == "all"
34
- Requires-Dist: opentelemetry-proto==1.21.0; extra == "all"
35
- Requires-Dist: PyNaCl; extra == "all"
36
31
  Requires-Dist: opentelemetry-instrumentation-aiohttp-client>=0.42b0; extra == "all"
37
- Requires-Dist: opentelemetry-exporter-jaeger==1.21.0; extra == "all"
38
- Requires-Dist: nats-py[nkeys]>=2.5.0; extra == "all"
32
+ Requires-Dist: grpcio<1.63.0,>=1.44.0; extra == "all"
39
33
  Requires-Dist: opentelemetry-propagator-b3==1.21.0; extra == "all"
40
- Requires-Dist: opentelemetry-api==1.21.0; extra == "all"
41
34
  Requires-Dist: opentelemetry-semantic-conventions>=0.42b0; extra == "all"
42
- Requires-Dist: grpcio-status<1.63.0,>=1.44.0; extra == "all"
35
+ Requires-Dist: grpcio-reflection<1.63.0,>=1.44.0; extra == "all"
36
+ Requires-Dist: nats-py[nkeys]>=2.5.0; extra == "all"
37
+ Requires-Dist: grpcio-testing<1.63.0,>=1.44.0; extra == "all"
43
38
  Requires-Dist: fastapi; extra == "all"
44
39
  Requires-Dist: grpcio-tools<1.63.0,>=1.44.0; extra == "all"
40
+ Requires-Dist: opentelemetry-exporter-jaeger==1.21.0; extra == "all"
41
+ Requires-Dist: opentelemetry-api==1.21.0; extra == "all"
42
+ Requires-Dist: grpcio-channelz<1.63.0,>=1.44.0; extra == "all"
43
+ Requires-Dist: opentelemetry-proto==1.21.0; extra == "all"
45
44
  Requires-Dist: opentelemetry-sdk==1.21.0; extra == "all"
46
- Requires-Dist: grpcio-health-checking<1.63.0,>=1.44.0; extra == "all"
45
+ Requires-Dist: grpcio-status<1.63.0,>=1.44.0; extra == "all"
46
+ Requires-Dist: PyNaCl; extra == "all"
47
47
  Provides-Extra: fastapi
48
48
  Requires-Dist: fastapi; extra == "fastapi"
49
49
  Requires-Dist: opentelemetry-sdk==1.21.0; extra == "fastapi"
@@ -15,7 +15,7 @@ nucliadb_telemetry/settings.py,sha256=Gr5rC9tBKHwck6sMMP76rn4Zgwh1w81dSzJJNcgkZv
15
15
  nucliadb_telemetry/tracerprovider.py,sha256=ycVqSMo0NTa7EEv4QLC8qAt0NYKbOy8uC9k14PjAiuk,3744
16
16
  nucliadb_telemetry/utils.py,sha256=lqbW5SjpGcfEhiJUScYeaNrtt5BFnOTaJn5dwnjCVMM,4765
17
17
  nucliadb_telemetry/fastapi/__init__.py,sha256=NRtQtyE1jZzTK5bZETYqb0d6bpjthTAt-UXiO8DAQWQ,3716
18
- nucliadb_telemetry/fastapi/context.py,sha256=qhl3rVDtqDfnsCHBAlv-eX8SUSlooMnsryBcV5FMZvU,1530
18
+ nucliadb_telemetry/fastapi/context.py,sha256=441ggcZuI6aFYrAJpw1jCTzMy-1gUoBpIvNz1QtB7HQ,1651
19
19
  nucliadb_telemetry/fastapi/metrics.py,sha256=15GDaTNslQ00AZEAZvQFC8OyVIKdKLjzhafnWbsfytw,3906
20
20
  nucliadb_telemetry/fastapi/tracing.py,sha256=U85I3QIFb27aj4v3Cl6l5evEgskP12LuEXW4pAsvGCc,15052
21
21
  nucliadb_telemetry/fastapi/utils.py,sha256=HtfhBSaYs_HWHx7SBp0pPAsoig5CLcHNFIFnzb-RXOE,2979
@@ -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-5.2.1.post1869.dist-info/METADATA,sha256=1w2QRJuveau2N2Wq263-WCezWm0ehWlhnHlxOlJ3mm8,10708
34
- nucliadb_telemetry-5.2.1.post1869.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
35
- nucliadb_telemetry-5.2.1.post1869.dist-info/top_level.txt,sha256=3qEHI_5ttqQIL2gkNYwSlKsFyBBiEzDiIy9UKISzOaQ,19
36
- nucliadb_telemetry-5.2.1.post1869.dist-info/RECORD,,
33
+ nucliadb_telemetry-5.2.1.post1873.dist-info/METADATA,sha256=KmFDzJmg-BrVjZdlPXRBSewDaqJRjUOr61fQ2Dqxq-4,10708
34
+ nucliadb_telemetry-5.2.1.post1873.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
35
+ nucliadb_telemetry-5.2.1.post1873.dist-info/top_level.txt,sha256=3qEHI_5ttqQIL2gkNYwSlKsFyBBiEzDiIy9UKISzOaQ,19
36
+ nucliadb_telemetry-5.2.1.post1873.dist-info/RECORD,,