Skip to content

Commit

Permalink
Update pymemcache instrumentation to support pymemcache version > 1.3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
rjduffner committed Mar 4, 2022
1 parent 2ab6641 commit 1cb28a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `opentelemetry-instrumentation-falcon` Safer patching mechanism
([#895](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/895))

### 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.


_instruments = ("pymemcache ~= 1.3",)
_instruments = ("pymemcache > 2, < 4",)
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -192,18 +192,18 @@ 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"]
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(
Expand Down Expand Up @@ -243,7 +243,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()
Expand All @@ -252,7 +252,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()
Expand All @@ -261,7 +261,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()
Expand Down Expand Up @@ -445,7 +445,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()
Expand Down

0 comments on commit 1cb28a6

Please sign in to comment.