Skip to content

Commit 1d92e89

Browse files
authored
Redis: Validate min version before instrumenting (#174)
* Validate min redis version before instrumenting * Make sure not to send empty trace payloads * Code comment
1 parent 06c590e commit 1d92e89

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

instana/agent.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ def report_traces(self, spans):
214214
Used to report entity data (metrics & snapshot) to the host agent.
215215
"""
216216
try:
217+
# Concurrency double check: Don't report if we don't have
218+
# any spans
219+
if len(spans) == 0:
220+
return 0
221+
217222
response = None
218223
response = self.client.post(self.__traces_url(),
219224
data=self.to_json(spans),

instana/instrumentation/redis.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
try:
99
import redis
1010

11-
if redis.VERSION < (3, 0, 0):
11+
if ((redis.VERSION >= (2, 10, 6)) and (redis.VERSION < (3, 0, 0))):
1212

1313
@wrapt.patch_function_wrapper('redis.client','StrictRedis.execute_command')
1414
def execute_command_with_instana(wrapped, instance, args, kwargs):
@@ -76,6 +76,7 @@ def execute_with_instana(wrapped, instance, args, kwargs):
7676

7777
logger.debug("Instrumenting redis")
7878
else:
79-
logger.debug("redis >=3.0.0 not supported (yet)")
79+
logger.debug("redis <= 2.10.5 >=3.0.0 not supported.")
80+
logger.debug(" --> https://docs.instana.io/ecosystem/python/supported-versions/#tracing")
8081
except ImportError:
8182
pass

0 commit comments

Comments
 (0)