opentelemetry-python-contrib-external-valkey 0.59b0__tar.gz → 0.60b0__tar.gz
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.
- {opentelemetry_python_contrib_external_valkey-0.59b0 → opentelemetry_python_contrib_external_valkey-0.60b0}/PKG-INFO +3 -3
- {opentelemetry_python_contrib_external_valkey-0.59b0 → opentelemetry_python_contrib_external_valkey-0.60b0}/README.md +2 -2
- {opentelemetry_python_contrib_external_valkey-0.59b0 → opentelemetry_python_contrib_external_valkey-0.60b0}/pyproject.toml +1 -1
- {opentelemetry_python_contrib_external_valkey-0.59b0 → opentelemetry_python_contrib_external_valkey-0.60b0}/src/opentelemetry/instrumentation/valkey/__init__.py +45 -1
- {opentelemetry_python_contrib_external_valkey-0.59b0 → opentelemetry_python_contrib_external_valkey-0.60b0}/src/opentelemetry/instrumentation/valkey/util.py +1 -1
- {opentelemetry_python_contrib_external_valkey-0.59b0 → opentelemetry_python_contrib_external_valkey-0.60b0}/src/opentelemetry/instrumentation/valkey/version.py +1 -1
- {opentelemetry_python_contrib_external_valkey-0.59b0 → opentelemetry_python_contrib_external_valkey-0.60b0}/LICENSE +0 -0
- {opentelemetry_python_contrib_external_valkey-0.59b0 → opentelemetry_python_contrib_external_valkey-0.60b0}/src/opentelemetry/instrumentation/valkey/custom_types.py +0 -0
- {opentelemetry_python_contrib_external_valkey-0.59b0 → opentelemetry_python_contrib_external_valkey-0.60b0}/src/opentelemetry/instrumentation/valkey/package.py +0 -0
- {opentelemetry_python_contrib_external_valkey-0.59b0 → opentelemetry_python_contrib_external_valkey-0.60b0}/src/opentelemetry/instrumentation/valkey/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opentelemetry-python-contrib-external-valkey
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.60b0
|
|
4
4
|
Summary: OpenTelemetry Valkey instrumentation
|
|
5
5
|
Author: Philip Meier
|
|
6
6
|
Author-email: Philip Meier <github.pmeier@posteo.de>
|
|
@@ -19,7 +19,7 @@ Description-Content-Type: text/markdown
|
|
|
19
19
|
|
|
20
20
|
## How do I install it?
|
|
21
21
|
|
|
22
|
-
`opentelemetry-python-contrib-external-valkey` is available on [PyPI](). You can install it with
|
|
22
|
+
`opentelemetry-python-contrib-external-valkey` is available on [PyPI](https://pypi.org/project/opentelemetry-python-contrib-external-valkey). You can install it with
|
|
23
23
|
|
|
24
24
|
```shell
|
|
25
25
|
pip install opentelemetry-python-contrib-external-valkey
|
|
@@ -47,7 +47,7 @@ For more detailed documentation please have a look at the [`opentelemetry-instru
|
|
|
47
47
|
|
|
48
48
|
## Why is this needed?
|
|
49
49
|
|
|
50
|
-
`opentelemetry-instrumentation-redis` instruments the `redis` module and has multiple `isinstance` checks for classes from it. Since the [Valkey Python Client] is a fork of the [Redis Python Client](https://github.com/redis/redis-py), any instrumentation through `opentelemetry-instrumentation-redis` has no effect on the `valkey` module or any of its classes. `opentelemetry-python-contrib-external-valkey` fills this gap until Valkey is [officially supported](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3478) and gives Valkey users the same user experience for instrumentation as Redis users.
|
|
50
|
+
`opentelemetry-instrumentation-redis` instruments the `redis` module and has multiple `isinstance` checks for classes from it. Since the [Valkey Python Client](https://github.com/valkey-io/valkey-py) is a fork of the [Redis Python Client](https://github.com/redis/redis-py), any instrumentation through `opentelemetry-instrumentation-redis` has no effect on the `valkey` module or any of its classes. `opentelemetry-python-contrib-external-valkey` fills this gap until Valkey is [officially supported](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3478) and gives Valkey users the same user experience for instrumentation as Redis users.
|
|
51
51
|
|
|
52
52
|
## How does it work?
|
|
53
53
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## How do I install it?
|
|
6
6
|
|
|
7
|
-
`opentelemetry-python-contrib-external-valkey` is available on [PyPI](). You can install it with
|
|
7
|
+
`opentelemetry-python-contrib-external-valkey` is available on [PyPI](https://pypi.org/project/opentelemetry-python-contrib-external-valkey). You can install it with
|
|
8
8
|
|
|
9
9
|
```shell
|
|
10
10
|
pip install opentelemetry-python-contrib-external-valkey
|
|
@@ -32,7 +32,7 @@ For more detailed documentation please have a look at the [`opentelemetry-instru
|
|
|
32
32
|
|
|
33
33
|
## Why is this needed?
|
|
34
34
|
|
|
35
|
-
`opentelemetry-instrumentation-redis` instruments the `redis` module and has multiple `isinstance` checks for classes from it. Since the [Valkey Python Client] is a fork of the [Redis Python Client](https://github.com/redis/redis-py), any instrumentation through `opentelemetry-instrumentation-redis` has no effect on the `valkey` module or any of its classes. `opentelemetry-python-contrib-external-valkey` fills this gap until Valkey is [officially supported](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3478) and gives Valkey users the same user experience for instrumentation as Redis users.
|
|
35
|
+
`opentelemetry-instrumentation-redis` instruments the `redis` module and has multiple `isinstance` checks for classes from it. Since the [Valkey Python Client](https://github.com/valkey-io/valkey-py) is a fork of the [Redis Python Client](https://github.com/redis/redis-py), any instrumentation through `opentelemetry-instrumentation-redis` has no effect on the `valkey` module or any of its classes. `opentelemetry-python-contrib-external-valkey` fills this gap until Valkey is [officially supported](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3478) and gives Valkey users the same user experience for instrumentation as Redis users.
|
|
36
36
|
|
|
37
37
|
## How does it work?
|
|
38
38
|
|
|
@@ -111,6 +111,35 @@ Request/Response Hooks
|
|
|
111
111
|
client = valkey.StrictValkey(host="localhost", port=6379)
|
|
112
112
|
client.get("my-key")
|
|
113
113
|
|
|
114
|
+
Suppress Instrumentation
|
|
115
|
+
------------------------
|
|
116
|
+
|
|
117
|
+
You can use the ``suppress_instrumentation`` context manager to prevent instrumentation
|
|
118
|
+
from being applied to specific Valkey operations. This is useful when you want to avoid
|
|
119
|
+
creating spans for internal operations, health checks, or during specific code paths.
|
|
120
|
+
|
|
121
|
+
.. code:: python
|
|
122
|
+
|
|
123
|
+
from opentelemetry.instrumentation.valkey import ValkeyInstrumentor
|
|
124
|
+
from opentelemetry.instrumentation.utils import suppress_instrumentation
|
|
125
|
+
import valkey
|
|
126
|
+
|
|
127
|
+
# Instrument valkey
|
|
128
|
+
ValkeyInstrumentor().instrument()
|
|
129
|
+
|
|
130
|
+
client = valkey.StrictValkey(host="localhost", port=6379)
|
|
131
|
+
|
|
132
|
+
# This will report a span
|
|
133
|
+
client.get("my-key")
|
|
134
|
+
|
|
135
|
+
# This will NOT report a span
|
|
136
|
+
with suppress_instrumentation():
|
|
137
|
+
client.get("internal-key")
|
|
138
|
+
client.set("cache-key", "value")
|
|
139
|
+
|
|
140
|
+
# This will report a span again
|
|
141
|
+
client.get("another-key")
|
|
142
|
+
|
|
114
143
|
API
|
|
115
144
|
---
|
|
116
145
|
"""
|
|
@@ -135,7 +164,10 @@ from opentelemetry.instrumentation.valkey.util import (
|
|
|
135
164
|
_set_connection_attributes,
|
|
136
165
|
)
|
|
137
166
|
from opentelemetry.instrumentation.valkey.version import __version__
|
|
138
|
-
from opentelemetry.instrumentation.utils import
|
|
167
|
+
from opentelemetry.instrumentation.utils import (
|
|
168
|
+
is_instrumentation_enabled,
|
|
169
|
+
unwrap,
|
|
170
|
+
)
|
|
139
171
|
from opentelemetry.semconv._incubating.attributes.db_attributes import (
|
|
140
172
|
DB_STATEMENT,
|
|
141
173
|
)
|
|
@@ -197,6 +229,9 @@ def _traced_execute_factory(
|
|
|
197
229
|
args: tuple[Any, ...],
|
|
198
230
|
kwargs: dict[str, Any],
|
|
199
231
|
) -> R:
|
|
232
|
+
if not is_instrumentation_enabled():
|
|
233
|
+
return func(*args, **kwargs)
|
|
234
|
+
|
|
200
235
|
query = _format_command_args(args)
|
|
201
236
|
name = _build_span_name(instance, args)
|
|
202
237
|
with tracer.start_as_current_span(
|
|
@@ -232,6 +267,9 @@ def _traced_execute_pipeline_factory(
|
|
|
232
267
|
args: tuple[Any, ...],
|
|
233
268
|
kwargs: dict[str, Any],
|
|
234
269
|
) -> R:
|
|
270
|
+
if not is_instrumentation_enabled():
|
|
271
|
+
return func(*args, **kwargs)
|
|
272
|
+
|
|
235
273
|
(
|
|
236
274
|
command_stack,
|
|
237
275
|
resource,
|
|
@@ -277,6 +315,9 @@ def _async_traced_execute_factory(
|
|
|
277
315
|
args: tuple[Any, ...],
|
|
278
316
|
kwargs: dict[str, Any],
|
|
279
317
|
) -> Awaitable[R]:
|
|
318
|
+
if not is_instrumentation_enabled():
|
|
319
|
+
return await func(*args, **kwargs)
|
|
320
|
+
|
|
280
321
|
query = _format_command_args(args)
|
|
281
322
|
name = _build_span_name(instance, args)
|
|
282
323
|
|
|
@@ -308,6 +349,9 @@ def _async_traced_execute_pipeline_factory(
|
|
|
308
349
|
args: tuple[Any, ...],
|
|
309
350
|
kwargs: dict[str, Any],
|
|
310
351
|
) -> Awaitable[R]:
|
|
352
|
+
if not is_instrumentation_enabled():
|
|
353
|
+
return await func(*args, **kwargs)
|
|
354
|
+
|
|
311
355
|
(
|
|
312
356
|
command_stack,
|
|
313
357
|
resource,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|