Skip to content

Commit e3eca0c

Browse files
vikiphabasepi
andauthored
fix for unix socket memcache config (#1357)
Co-authored-by: Colton Myers <colton.myers@gmail.com>
1 parent b36dbac commit e3eca0c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎elasticapm/instrumentation/packages/python_memcached.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2828
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2929
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
import socket
3031

3132
from elasticapm.instrumentation.packages.base import AbstractInstrumentedModule
3233
from elasticapm.traces import capture_span
@@ -66,7 +67,11 @@ def call(self, module, method, wrapped, instance, args, kwargs):
6667
name = self.get_wrapped_name(wrapped, instance, method)
6768
address, port = None, None
6869
if instance.servers:
69-
address, port = instance.servers[0].address
70+
first_server = instance.servers[0]
71+
if first_server.family == socket.AF_UNIX:
72+
address = first_server.address
73+
else:
74+
address, port = first_server.address
7075
destination = {
7176
"address": address,
7277
"port": port,

0 commit comments

Comments
 (0)