From 3147caacb8a736d810a12987764cd2ca8ef207bd Mon Sep 17 00:00:00 2001 From: Peter Giacomo Lombardo Date: Mon, 24 Jun 2019 23:38:41 +0200 Subject: [PATCH 1/3] Validate min redis version before instrumenting --- instana/instrumentation/redis.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/instana/instrumentation/redis.py b/instana/instrumentation/redis.py index f8eb4605..8c95ec55 100644 --- a/instana/instrumentation/redis.py +++ b/instana/instrumentation/redis.py @@ -8,7 +8,7 @@ try: import redis - if redis.VERSION < (3, 0, 0): + if ((redis.VERSION >= (2, 10, 6)) and (redis.VERSION < (3, 0, 0))): @wrapt.patch_function_wrapper('redis.client','StrictRedis.execute_command') def execute_command_with_instana(wrapped, instance, args, kwargs): @@ -76,6 +76,7 @@ def execute_with_instana(wrapped, instance, args, kwargs): logger.debug("Instrumenting redis") else: - logger.debug("redis >=3.0.0 not supported (yet)") + logger.debug("redis <= 2.10.5 >=3.0.0 not supported.") + logger.debug(" --> https://docs.instana.io/ecosystem/python/supported-versions/#tracing") except ImportError: pass From 647e906a5d62e2dbdee87e0e648556c4a984cae2 Mon Sep 17 00:00:00 2001 From: Peter Giacomo Lombardo Date: Tue, 25 Jun 2019 00:08:22 +0200 Subject: [PATCH 2/3] Make sure not to send empty trace payloads --- instana/agent.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/instana/agent.py b/instana/agent.py index 676b8e59..3121dc7f 100644 --- a/instana/agent.py +++ b/instana/agent.py @@ -214,6 +214,9 @@ def report_traces(self, spans): Used to report entity data (metrics & snapshot) to the host agent. """ try: + if len(spans) == 0: + return 0 + response = None response = self.client.post(self.__traces_url(), data=self.to_json(spans), From ee0e7843fc3f5a57eef81107b2250e0018e398ee Mon Sep 17 00:00:00 2001 From: Peter Giacomo Lombardo Date: Tue, 25 Jun 2019 10:48:34 +0200 Subject: [PATCH 3/3] Code comment --- instana/agent.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/instana/agent.py b/instana/agent.py index 3121dc7f..1341baae 100644 --- a/instana/agent.py +++ b/instana/agent.py @@ -214,6 +214,8 @@ def report_traces(self, spans): Used to report entity data (metrics & snapshot) to the host agent. """ try: + # Concurrency double check: Don't report if we don't have + # any spans if len(spans) == 0: return 0