Pika

Helios' instrumentation of Pika enables developers to visualize, troubleshoot and test their applicative flows that include Pika operations.

800

basic_get

Since the basic_get API is not provided with a callback function to handle messages (as opposed to basic_consume), there isn't a scope in which the message context can be applied.
Therefore, applying the context has to be done manually using Helios' RabbitMqMessageContext with statement:

import pika
from helios import RabbitMqMessageContext

channel = pika.BlockingConnection().channel()
channel.queue_declare('your_queue')
method, headers, payload = channel.basic_get('your_queue')

with RabbitMqMessageContext(method, headers, payload):
    # Handle your message here.

Notice that the with statement should receive the method, headers and the payload returned by basic_get in order for Helios to apply the context and collect the payload.

Trace visualization

A simple flow that includes a producer service using basic_publish and a consumer service using basic_get will look in Helios' trace visualization like this:

888