- Notifications
You must be signed in to change notification settings - Fork 231
Open
Labels
Description
Describe the bug: ...
aioredis instrumentation doesn't work with elastic-apm==6.2.2. The APM dashboard is not able to show it as dependency or in traces. I am using aioredis==1.2.0
Environment (please complete the following information)
- OS: [e.g. Linux] - MacOs Catalina
- Python version: 3.7.2
- Framework and version [e.g. Django 2.1]: aiohttp
- APM Server version: 7.13
- Agent version: 6.2.2
Additional context
I have added a couple of comments in the following merged PR: #1129
I made some changes to the following class to make it work:
Existing class:
class RedisConnectionInstrumentation(AbstractInstrumentedModule): name = "aioredis" instrument_list = (("aioredis.connection", "RedisConnection.execute"), ("aioredis.pool", "ConnectionsPool.execute_pubsub")) def call(self, module, method, wrapped, instance, args, kwargs): span = execution_context.get_span() if span and span.subtype == "aioredis": span.context["destination"] = _get_destination_info(instance) return wrapped(*args, **kwargs)
Updated class:
class RedisConnectionInstrumentation(AbstractInstrumentedModule): name = "aioredis" instrument_list = (("aioredis.connection", "RedisConnection.execute"), ("aioredis.pool", "ConnectionsPool.execute_pubsub")) async def call(self, module, method, wrapped, instance, args, kwargs): span = execution_context.get_span() wrapped_name = self.get_wrapped_name(wrapped, instance, method) if span and span.subtype == "aioredis": span.context["destination"] = _get_destination_info(instance) with async_capture_span( wrapped_name, span_type="db", span_subtype="redis", span_action="query", leaf=True ): return await wrapped(*args, **kwargs)
Also, span is coming as None here so it would never add the destination information to the span, hence it won;t appear in dependency.