RabbitMq 消息trace Firehose Tracer

https://www.rabbitmq.com/firehose.html

 

Firehose Tracer

Sometimes, during development or debugging, it's useful to be able to see every message that is published, and every message that is delivered. RabbitMQ has a "firehose" feature, where the administrator can enable (on a per-node, per-vhost basis) an exchange to which publish- and delivery-notifications should be CCed.

These notifications are close to what's happening on the wire - for example you will see unacked messages.

When the feature is switched off, it has no effect on performance; when it is switched on, performance will drop somewhat due to additional messages being generated and routed.

Enabling the firehose

  1. Decide which node, and which vhost, you want to enable it for. In the examples below, we assume the default vhost, "/", and the default node "rabbit@(hostname)". Use the -nargument to specify a node other than, and the -p argument to specify another vhost.
  2. Within your chosen vhost create queues, bind them to the topic exchange amq.rabbitmq.trace, and begin consuming.
  3. Run rabbitmqctl trace_on.

Disabling the firehose

  1. Run rabbitmqctl trace_off.
  2. Clean up the queues used by the firehose.

Note that the firehose state is not persistent; it will default of off at server start time.

Firehose notification format

The firehose publishes messages to the topic exchange amq.rabbitmq.trace with

  • routing key either "publish.exchangename", for messages entering the broker, or "deliver.queuename", for messages leaving the broker;
  • headers containing metadata about the original message:

     

    HeaderTypeDescription
    exchange_namelongstrname of the exchange to which the message was published
    routing_keysarrayrouting key plus contents of CC and BCC headers
    propertiestablecontent properties
    nodelongstrErlang node on which the trace message was generated
    redeliveredsignedintwhether the message has its redelivered flag set (messages leaving the broker only)

     

  • body corresponding to the body of the original message

Tracing plugin

The rabbitmq_tracing plugin builds on top of the tracer and provides a GUI to capture traced messages and log them in text or JSON format files.

Getting Help and Providing Feedback

If you have questions about the contents of this guide or any other topic related to RabbitMQ, don't hesitate to ask them on the RabbitMQ mailing list.

Help Us Improve the Docs <3

If you'd like to contribute an improvement to the site, its source is available on GitHub. Simply fork the repository and submit a pull request. Thank you!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值