Skip to content

Pin.override not working for pymemcached when using HashClient #5637

@damjankuznar

Description

@damjankuznar

Summary of problem

Pin.override not working for pymemcached lib when using HashClient. This is further complicated when setting use_pooling=True which then dynamically creates client connections. Being able to only override service name for Client instances is not really useful since any kind of serious use of pymemcached will involve a Memcached cluster and use of HashClient.

Which version of dd-trace-py are you using?

1.12.0

Which version of pip are you using?

22.3.1

Which libraries and their versions are you using?

`pip freeze` ddtrace==1.12.0 pymemcache==4.0.0

How can we reproduce your problem?

Minimal example to demonstrate the issue:

from ddtrace import Pin
from pymemcache import HashClient

servers = ["localhost:11211"]

client = HashClient(servers=servers, use_pooling=True)

Pin.override(client, service="memcached-hashclient-pooling")

# still reports as `memcached` service in DataDog
client.set("test", "value")

Only Client class is patched and that doesn't work well with overriding since client connections are created dynamically in HashClient and PooledClient class.

What is the result that you get?

After using Pin.override on HashClient instance ddtrace still reports traces as memcached service in DataDog.

What is the result that you expected?

I would expect that I could override service name for HashClient.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions