From d143140599de14439fcf5711755c1a9bc6ac0cb9 Mon Sep 17 00:00:00 2001 From: Dimitra Paraskevopoulou Date: Thu, 9 Dec 2021 05:27:27 +0100 Subject: [PATCH] Testing cassandra (#344) fixing bug from customer ticket https://instana.zendesk.com/agent/tickets/23556 * update version --- instana/instrumentation/cassandra_inst.py | 2 +- instana/version.py | 2 +- tests/clients/test_cassandra-driver.py | 5 +++-- tests/requirements-cassandra.txt | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/instana/instrumentation/cassandra_inst.py b/instana/instrumentation/cassandra_inst.py index d1a208858..7f75ff641 100644 --- a/instana/instrumentation/cassandra_inst.py +++ b/instana/instrumentation/cassandra_inst.py @@ -47,7 +47,7 @@ def cb_request_finish(results, span, fn): def cb_request_error(results, span, fn): collect_response(span, fn) - span.mark_as_errored({"cassandra.error": results.message}) + span.mark_as_errored({"cassandra.error": results.summary}) span.finish() diff --git a/instana/version.py b/instana/version.py index bb9b16d5d..47f84ff16 100644 --- a/instana/version.py +++ b/instana/version.py @@ -3,4 +3,4 @@ # Module version file. Used by setup.py and snapshot reporting. -VERSION = '1.36.1' +VERSION = '1.36.2' diff --git a/tests/clients/test_cassandra-driver.py b/tests/clients/test_cassandra-driver.py index 0af28359b..b8ca44a92 100644 --- a/tests/clients/test_cassandra-driver.py +++ b/tests/clients/test_cassandra-driver.py @@ -19,7 +19,8 @@ cluster = Cluster([testenv['cassandra_host']], load_balancing_policy=None) session = cluster.connect() -session.execute("CREATE KEYSPACE IF NOT EXISTS instana_tests WITH replication = {'class':'SimpleStrategy', 'replication_factor':1};") +session.execute( + "CREATE KEYSPACE IF NOT EXISTS instana_tests WITH replication = {'class':'SimpleStrategy', 'replication_factor':1};") session.set_keyspace('instana_tests') session.execute("CREATE TABLE IF NOT EXISTS users(" "id int PRIMARY KEY," @@ -203,7 +204,7 @@ def test_execute_error(self): self.assertEqual(cspan.data["cassandra"]["keyspace"], 'instana_tests') self.assertIsNone(cspan.data["cassandra"]["achievedConsistency"]) self.assertIsNotNone(cspan.data["cassandra"]["triedHosts"]) - self.assertIsNotNone(cspan.data["cassandra"]["error"]) + self.assertEqual(cspan.data["cassandra"]["error"], "Syntax error in CQL query") def test_prepared_statement(self): prepared = None diff --git a/tests/requirements-cassandra.txt b/tests/requirements-cassandra.txt index 40ce6ab40..1b6f74688 100644 --- a/tests/requirements-cassandra.txt +++ b/tests/requirements-cassandra.txt @@ -1,4 +1,4 @@ -cassandra-driver==3.20.2 +cassandra-driver>=3.20.2 mock>=2.0.0 nose>=1.0 pytest>=4.6