Conversation
| assert span.attributes["service"] == self.TEST_SERVICE | ||
|
|
||
| def test_patch_unpatch(self): | ||
| # Test patch idempotence |
There was a problem hiding this comment.
opentelemetry.instrumentor.BaseInstrumentor.instrument already takes care of idempotence. It would be better to move the code inside patch to _instrument in order to be able to benefit from this feature.
There was a problem hiding this comment.
it makes sense to test the idempotency of patch/unpatch for anyone using it to programmatically enable instrumentation
...ntation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/patch.py
Outdated
Show resolved
Hide resolved
...ntation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/patch.py
Outdated
Show resolved
Hide resolved
...ion/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/constants.py
Outdated
Show resolved
Hide resolved
...entation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/util.py
Outdated
Show resolved
Hide resolved
...ion/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/constants.py
Outdated
Show resolved
Hide resolved
...ion/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/constants.py
Outdated
Show resolved
Hide resolved
...ion/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/constants.py
Outdated
Show resolved
Hide resolved
mauriciovasquezbernal
left a comment
There was a problem hiding this comment.
Some more minor comments, I tested and it works with a basic example.
I haven't reviewed the exact attributes you are setting on the span, as those come from datadog I'll suppose they are fine.
| import redis | ||
|
|
||
| # You can patch redis specifically | ||
| patch() |
There was a problem hiding this comment.
I strongly think this should be using also the instrumentor interface, but will ignore for now until we clarify those ideas.
There was a problem hiding this comment.
I agree, I'd rather not block here until the auto-instrumentation interface is completed. Here's an issue to track this: #38
|
|
||
|
|
||
| def traced_execute_command(func, instance, args, kwargs): | ||
| tracer = trace.get_tracer(_DEFAULT_SERVICE, __version__) |
There was a problem hiding this comment.
I think this need some more discussion, creating a new tracer for each operation doesn't look like a good solution to me. Somehow the integration should have access to a tracer and avoid creating it for each operation call. I opened an issue for a related discussion open-telemetry/opentelemetry-python#585.
| pipeline.execute() | ||
|
|
||
| spans = self.get_spans() | ||
| self.assertEqual(len(spans), 2) |
There was a problem hiding this comment.
Out of curiosity, what is the second span and why there is not any test on that?
There was a problem hiding this comment.
added a comment to clarify, also updated the test to use different set parameters
instrumentation/opentelemetry-instrumentation-redis/tests/test_redis.py
Outdated
Show resolved
Hide resolved
instrumentation/opentelemetry-instrumentation-redis/tests/test_redis.py
Outdated
Show resolved
Hide resolved
Co-Authored-By: Mauricio Vásquez <mauricio@kinvolk.io>
mauriciovasquezbernal
left a comment
There was a problem hiding this comment.
LGTM, just a minor comment that could be implemented in further PRs.
| _CMD = "redis.command" | ||
|
|
||
|
|
||
| def patch(tracer=None): |
There was a problem hiding this comment.
Maybe it's a good idea to update right now to take a TracerProvider as described in open-telemetry/opentelemetry-python#585. Up to you.
|
Closing in favour of open-telemetry/opentelemetry-python#595 |
Porting the existing redis instrumentation from the contrib repo to using the OpenTelemetry API and the OpenTelemetry Auto-instrumentation Instrumentor interface. Similiar to the sqlalchemy PR, the main thing that will need updating is to remove the patch/unpatch methods once the instrumentor interface changes have been merged. This is replacing open-telemetry/opentelemetry-python-contrib#21 Co-authored-by: Mauricio Vásquez <mauricio@kinvolk.io> Co-authored-by: Leighton Chen <lechen@microsoft.com> Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com> Co-authored-by: Chris Kleinknecht <libc@google.com>
…y#595) Porting the existing redis instrumentation from the contrib repo to using the OpenTelemetry API and the OpenTelemetry Auto-instrumentation Instrumentor interface. Similiar to the sqlalchemy PR, the main thing that will need updating is to remove the patch/unpatch methods once the instrumentor interface changes have been merged. This is replacing open-telemetry#21 Co-authored-by: Mauricio Vásquez <mauricio@kinvolk.io> Co-authored-by: Leighton Chen <lechen@microsoft.com> Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com> Co-authored-by: Chris Kleinknecht <libc@google.com>
…y#595) Porting the existing redis instrumentation from the contrib repo to using the OpenTelemetry API and the OpenTelemetry Auto-instrumentation Instrumentor interface. Similiar to the sqlalchemy PR, the main thing that will need updating is to remove the patch/unpatch methods once the instrumentor interface changes have been merged. This is replacing open-telemetry#21 Co-authored-by: Mauricio Vásquez <mauricio@kinvolk.io> Co-authored-by: Leighton Chen <lechen@microsoft.com> Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com> Co-authored-by: Chris Kleinknecht <libc@google.com>
…y#595) Porting the existing redis instrumentation from the contrib repo to using the OpenTelemetry API and the OpenTelemetry Auto-instrumentation Instrumentor interface. Similiar to the sqlalchemy PR, the main thing that will need updating is to remove the patch/unpatch methods once the instrumentor interface changes have been merged. This is replacing open-telemetry#21 Co-authored-by: Mauricio Vásquez <mauricio@kinvolk.io> Co-authored-by: Leighton Chen <lechen@microsoft.com> Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com> Co-authored-by: Chris Kleinknecht <libc@google.com>
…y#595) Porting the existing redis instrumentation from the contrib repo to using the OpenTelemetry API and the OpenTelemetry Auto-instrumentation Instrumentor interface. Similiar to the sqlalchemy PR, the main thing that will need updating is to remove the patch/unpatch methods once the instrumentor interface changes have been merged. This is replacing open-telemetry#21 Co-authored-by: Mauricio Vásquez <mauricio@kinvolk.io> Co-authored-by: Leighton Chen <lechen@microsoft.com> Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com> Co-authored-by: Chris Kleinknecht <libc@google.com>
Porting the existing redis instrumentation to using the OpenTelemetry API and the OpenTelemetry Auto-instrumentation Patcher interface.
The process to make this happen is pretty straight forward:
ddtracepackageCouple of TODOs left:
NOTE: This currently still uses some utility functions in the ddtrace package.
fixes #15