Frame tracing¶
CoolAMQP allows you to trace every sent or received frame. Just provide an instance of
- class coolamqp.tracing.BaseFrameTracer¶
An abstract do-nothing frame tracer
- on_frame(timestamp, frame, direction)¶
Called by AMQP upon receiving a frame information
- Parameters:
timestamp (float) – timestamp
frame (
coolamqp.framing.base.AMQPFrame
) – frame that is sent or receiveddirection (str) – either ‘to_client’ or ‘to_server’
LoggingFrameTracer¶
To show each frame that is sent or received to the server use the following:
import logging
logger = logging.getLogger(__name__)
from coolamqp.tracing import LoggingFrameTracer
frame_tracer = LoggingFrameTracer(logger, logging.WARNING)
cluster = Cluster([NODE], log_frames=frame_logger)
cluster.start()
Documentation of the class:
- class coolamqp.tracing.LoggingFrameTracer(logger=None, log_level=30)¶
A frame tracer that outputs each frame to log
- Parameters:
logger – the logger to log onto (defaults to logging.getLogger(__name__))
log_level – the level of logging to log with
- on_frame(timestamp, frame, direction)¶
Called by AMQP upon receiving a frame information
- Parameters:
timestamp (float) – timestamp
frame (
coolamqp.framing.base.AMQPFrame
) – frame that is sent or receiveddirection (str) – either ‘to_client’ or ‘to_server’
HoldingFrameTracer¶
- class coolamqp.tracing.HoldingFrameTracer¶
A frame tracer that holds the frames in memory
- Variables:
frames – a list of tuple (direction:str (either ‘to_client’ or ‘to_server’), timestamp::float, frame::
AMQPFrame
)
- clear()¶
Clear internal frame list
- on_frame(timestamp, frame, direction)¶
Called by AMQP upon receiving a frame information
- Parameters:
timestamp (float) – timestamp
frame (
coolamqp.framing.base.AMQPFrame
) – frame that is sent or receiveddirection (str) – either ‘to_client’ or ‘to_server’