From 43b5558b8235defcc2ec13ee49e09e6aff014487 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Thu, 15 Feb 2018 10:18:46 +0100 Subject: [PATCH] Add trace logging on ZMQ sockets communication --- salt/transport/zeromq.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/salt/transport/zeromq.py b/salt/transport/zeromq.py index 2935004a6d..9c2ca038fe 100644 --- a/salt/transport/zeromq.py +++ b/salt/transport/zeromq.py @@ -794,27 +794,35 @@ class ZeroMQPubServerChannel(salt.transport.server.PubServerChannel): # Catch and handle EINTR from when this process is sent # SIGUSR1 gracefully so we don't choke and die horribly try: + log.trace('Getting data from puller %s', pull_uri) package = pull_sock.recv() unpacked_package = salt.payload.unpackage(package) if six.PY3: unpacked_package = salt.transport.frame.decode_embedded_strs(unpacked_package) payload = unpacked_package['payload'] + log.trace('Accepted unpacked package from puller') if self.opts['zmq_filtering']: # if you have a specific topic list, use that if 'topic_lst' in unpacked_package: for topic in unpacked_package['topic_lst']: + log.trace('Sending filtered data over publisher %s', pub_uri) # zmq filters are substring match, hash the topic # to avoid collisions htopic = hashlib.sha1(topic).hexdigest() pub_sock.send(htopic, flags=zmq.SNDMORE) pub_sock.send(payload) + log.trace('Filtered data has been sent') # otherwise its a broadcast else: # TODO: constants file for "broadcast" + log.trace('Sending broadcasted data over publisher %s', pub_uri) pub_sock.send('broadcast', flags=zmq.SNDMORE) pub_sock.send(payload) + log.trace('Broadcasted data has been sent') else: + log.trace('Sending ZMQ-unfiltered data over publisher %s', pub_uri) pub_sock.send(payload) + log.trace('Unfiltered data has been sent') except zmq.ZMQError as exc: if exc.errno == errno.EINTR: continue