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 16, 2022
1 parent abd01fb commit b7f060f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
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 @@ -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(
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit b7f060f

Please sign in to comment.