nucliadb-telemetry 5.2.1.post1856__py3-none-any.whl → 5.2.1.post1864__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,16 +16,13 @@
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
22
19
 
23
20
  from nucliadb_telemetry import context
24
21
 
25
22
  from .utils import get_path_template
26
23
 
27
24
 
28
- class ContextInjectorMiddleware(BaseHTTPMiddleware):
25
+ class ContextInjectorMiddleware:
29
26
  """
30
27
  Automatically inject context values for the current request's path parameters
31
28
 
@@ -33,9 +30,13 @@ class ContextInjectorMiddleware(BaseHTTPMiddleware):
33
30
  - `/api/v1/kb/{kbid}` would inject a context value for `kbid`
34
31
  """
35
32
 
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
33
+ def __init__(self, app):
34
+ self.app = app
40
35
 
41
- return await call_next(request)
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nucliadb_telemetry
3
- Version: 5.2.1.post1856
3
+ Version: 5.2.1.post1864
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-tools<1.63.0,>=1.44.0; extra == "all"
30
- Requires-Dist: grpcio-testing<1.63.0,>=1.44.0; extra == "all"
31
- Requires-Dist: opentelemetry-instrumentation-aiohttp-client>=0.42b0; extra == "all"
32
- Requires-Dist: grpcio<1.63.0,>=1.44.0; extra == "all"
29
+ Requires-Dist: grpcio-reflection<1.63.0,>=1.44.0; extra == "all"
30
+ Requires-Dist: opentelemetry-proto==1.21.0; extra == "all"
33
31
  Requires-Dist: grpcio-status<1.63.0,>=1.44.0; extra == "all"
34
- Requires-Dist: nats-py[nkeys]>=2.5.0; extra == "all"
35
- Requires-Dist: opentelemetry-api==1.21.0; extra == "all"
36
32
  Requires-Dist: grpcio-health-checking<1.63.0,>=1.44.0; extra == "all"
33
+ Requires-Dist: grpcio-testing<1.63.0,>=1.44.0; extra == "all"
37
34
  Requires-Dist: grpcio-channelz<1.63.0,>=1.44.0; extra == "all"
35
+ Requires-Dist: nats-py[nkeys]>=2.5.0; extra == "all"
36
+ Requires-Dist: opentelemetry-api==1.21.0; extra == "all"
37
+ Requires-Dist: opentelemetry-propagator-b3==1.21.0; extra == "all"
38
+ Requires-Dist: opentelemetry-instrumentation-aiohttp-client>=0.42b0; extra == "all"
39
+ Requires-Dist: grpcio-tools<1.63.0,>=1.44.0; extra == "all"
40
+ Requires-Dist: opentelemetry-instrumentation-fastapi>=0.42b0; extra == "all"
38
41
  Requires-Dist: opentelemetry-sdk==1.21.0; extra == "all"
39
- Requires-Dist: grpcio-reflection<1.63.0,>=1.44.0; extra == "all"
40
- Requires-Dist: opentelemetry-proto==1.21.0; extra == "all"
41
- Requires-Dist: opentelemetry-semantic-conventions>=0.42b0; extra == "all"
42
- Requires-Dist: PyNaCl; extra == "all"
42
+ Requires-Dist: grpcio<1.63.0,>=1.44.0; extra == "all"
43
43
  Requires-Dist: opentelemetry-exporter-jaeger==1.21.0; extra == "all"
44
- Requires-Dist: opentelemetry-instrumentation-fastapi>=0.42b0; extra == "all"
44
+ Requires-Dist: PyNaCl; extra == "all"
45
45
  Requires-Dist: fastapi; extra == "all"
46
- Requires-Dist: opentelemetry-propagator-b3==1.21.0; extra == "all"
46
+ Requires-Dist: opentelemetry-semantic-conventions>=0.42b0; 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=441ggcZuI6aFYrAJpw1jCTzMy-1gUoBpIvNz1QtB7HQ,1651
18
+ nucliadb_telemetry/fastapi/context.py,sha256=qhl3rVDtqDfnsCHBAlv-eX8SUSlooMnsryBcV5FMZvU,1530
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.post1856.dist-info/METADATA,sha256=iP1jQiU9Htr74qK3hxVWvSIUyI2IS67_brvLtH37F4w,10708
34
- nucliadb_telemetry-5.2.1.post1856.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
35
- nucliadb_telemetry-5.2.1.post1856.dist-info/top_level.txt,sha256=3qEHI_5ttqQIL2gkNYwSlKsFyBBiEzDiIy9UKISzOaQ,19
36
- nucliadb_telemetry-5.2.1.post1856.dist-info/RECORD,,
33
+ nucliadb_telemetry-5.2.1.post1864.dist-info/METADATA,sha256=ryJo16dnfvWB5t4LyLhbjkNvnnB3YP_fzqX1nWsfpis,10708
34
+ nucliadb_telemetry-5.2.1.post1864.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
35
+ nucliadb_telemetry-5.2.1.post1864.dist-info/top_level.txt,sha256=3qEHI_5ttqQIL2gkNYwSlKsFyBBiEzDiIy9UKISzOaQ,19
36
+ nucliadb_telemetry-5.2.1.post1864.dist-info/RECORD,,