diff --git a/CHANGELOG.md b/CHANGELOG.md index 933fbccf78..8325ebdcf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `opentelemetry-instrumentation-kafka-python` Fix topic extraction ([#949](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/949)) +### Changed + +- `opentelemetry-instrumentation-pymemcache` should run against newer versions of pymemcache. + ([#935](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/935)) + ## [1.9.1-0.28b1](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.9.1-0.28b1) - 2022-01-29 ### Fixed diff --git a/instrumentation/README.md b/instrumentation/README.md index 1421653a70..c656925704 100644 --- a/instrumentation/README.md +++ b/instrumentation/README.md @@ -23,7 +23,7 @@ | [opentelemetry-instrumentation-mysql](./opentelemetry-instrumentation-mysql) | mysql-connector-python ~= 8.0 | | [opentelemetry-instrumentation-pika](./opentelemetry-instrumentation-pika) | pika >= 0.12.0 | | [opentelemetry-instrumentation-psycopg2](./opentelemetry-instrumentation-psycopg2) | psycopg2 >= 2.7.3.1 | -| [opentelemetry-instrumentation-pymemcache](./opentelemetry-instrumentation-pymemcache) | pymemcache ~= 1.3 | +| [opentelemetry-instrumentation-pymemcache](./opentelemetry-instrumentation-pymemcache) | pymemcache > 2, < 4 | | [opentelemetry-instrumentation-pymongo](./opentelemetry-instrumentation-pymongo) | pymongo >= 3.1, < 5.0 | | [opentelemetry-instrumentation-pymysql](./opentelemetry-instrumentation-pymysql) | PyMySQL < 2 | | [opentelemetry-instrumentation-pyramid](./opentelemetry-instrumentation-pyramid) | pyramid >= 1.7 | diff --git a/instrumentation/opentelemetry-instrumentation-pymemcache/src/opentelemetry/instrumentation/pymemcache/package.py b/instrumentation/opentelemetry-instrumentation-pymemcache/src/opentelemetry/instrumentation/pymemcache/package.py index a2cfd56932..19fd69da1c 100644 --- a/instrumentation/opentelemetry-instrumentation-pymemcache/src/opentelemetry/instrumentation/pymemcache/package.py +++ b/instrumentation/opentelemetry-instrumentation-pymemcache/src/opentelemetry/instrumentation/pymemcache/package.py @@ -13,4 +13,4 @@ # limitations under the License. -_instruments = ("pymemcache ~= 1.3",) +_instruments = ("pymemcache > 2, < 4",) diff --git a/instrumentation/opentelemetry-instrumentation-pymemcache/tests/test_pymemcache.py b/instrumentation/opentelemetry-instrumentation-pymemcache/tests/test_pymemcache.py index 4756b5189d..fdc8e43ac3 100644 --- a/instrumentation/opentelemetry-instrumentation-pymemcache/tests/test_pymemcache.py +++ b/instrumentation/opentelemetry-instrumentation-pymemcache/tests/test_pymemcache.py @@ -126,11 +126,11 @@ def test_set_multi_success(self): client = self.make_client([b"STORED\r\n"]) # Alias for set_many, a convienance function that calls set for every key result = client.set_multi({b"key": b"value"}, noreply=False) - self.assertTrue(result) + assert len(result) == 0 spans = self.memory_exporter.get_finished_spans() - self.check_spans(spans, 2, ["set key", "set_multi key"]) + self.check_spans(spans, 1, ["set_multi key"]) def test_delete_not_found(self): client = self.make_client([b"NOT_FOUND\r\n"]) @@ -191,19 +191,17 @@ def test_delete_many_found(self): spans = self.memory_exporter.get_finished_spans() - self.check_spans( - spans, 3, ["add key", "delete key", "delete_many key"] - ) + self.check_spans(spans, 2, ["add key", "delete_many key"]) def test_set_many_success(self): client = self.make_client([b"STORED\r\n"]) # a convienance function that calls set for every key result = client.set_many({b"key": b"value"}, noreply=False) - self.assertTrue(result) + assert len(result) == 0 spans = self.memory_exporter.get_finished_spans() - self.check_spans(spans, 2, ["set key", "set_many key"]) + self.check_spans(spans, 1, ["set_many key"]) def test_set_get(self): client = self.make_client( @@ -243,7 +241,7 @@ def test_prepend_stored(self): def test_cas_stored(self): client = self.make_client([b"STORED\r\n"]) - result = client.cas(b"key", b"value", b"cas", noreply=False) + result = client.cas(b"key", b"value", 1, noreply=False) self.assertTrue(result) spans = self.memory_exporter.get_finished_spans() @@ -252,7 +250,7 @@ def test_cas_stored(self): def test_cas_exists(self): client = self.make_client([b"EXISTS\r\n"]) - result = client.cas(b"key", b"value", b"cas", noreply=False) + result = client.cas(b"key", b"value", 1, noreply=False) assert result is False spans = self.memory_exporter.get_finished_spans() @@ -261,7 +259,7 @@ def test_cas_exists(self): def test_cas_not_found(self): client = self.make_client([b"NOT_FOUND\r\n"]) - result = client.cas(b"key", b"value", b"cas", noreply=False) + result = client.cas(b"key", b"value", 1, noreply=False) assert result is None spans = self.memory_exporter.get_finished_spans() @@ -445,7 +443,7 @@ def test_version_success(self): def test_stats(self): client = self.make_client([b"STAT fake_stats 1\r\n", b"END\r\n"]) result = client.stats() - assert client.sock.send_bufs == [b"stats \r\n"] + assert client.sock.send_bufs == [b"stats\r\n"] assert result == {b"fake_stats": 1} spans = self.memory_exporter.get_finished_spans() diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py index a159d3bae9..5078fa5133 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py @@ -93,7 +93,7 @@ "instrumentation": "opentelemetry-instrumentation-psycopg2==0.29b0", }, "pymemcache": { - "library": "pymemcache ~= 1.3", + "library": "pymemcache > 2, < 4", "instrumentation": "opentelemetry-instrumentation-pymemcache==0.29b0", }, "pymongo": {