一旦开启,会影响性能,除非需要分析的时候才开启,否则不开启
可通过管理界面查看分析,其实底层就是firehose,只不过可以用界面查看更方便
进入rabbitmq的sbin文件夹。我的目录为D:\Program Files\RabbitMQ Server\rabbitmq_server-3.8.5\sbin,打开cmd窗口,执行如下命令。然后重启mq
rabbitmq-plugins enable rabbitmq_tracing
界面会增加一个Tracing按钮
1、format:一般选择text模式方便人去查看;json模式进行base64编码,是方便以后导出用来做程序分析的
2、max那个不用写
3、pattern:用#,表示无论是发起方发送消息还是接收方接收消息,都做记录;用publish.#,表示只记录发起方发送记录;用deliver.#,表示只记录接收方处理记录
直接点击“Trace log files”下面的列表查看对应的日志文件,如:test.log
发送
================================================================================
2019-11-13 7:10:14:036: Message published
Node: rabbit@hkgi-PC
Connection: 127.0.0.1:12452 -> 127.0.0.1:5672
Virtual host: testhost
User: admin
Channel: 2
Exchange:
Routing keys: [<<“OrderQueue1”>>]
Routed queues: [<<“OrderQueue1”>>]
Properties: [{<<“priority”>>,signedint,0},
{<<“delivery_mode”>>,signedint,2},
{<<“headers”>>,table,
[{<<“X-B3-ParentSpanId”>>,longstr,<<“31b1b0a9699c2d3f”>>},
{<<“X-B3-Sampled”>>,longstr,<<“1”>>},
{<<“spring_listener_return_correlation”>>,longstr,
<<“c5d011b7-3052-4186-89a7-1708a3a8ebac”>>},
{<<“X-B3-TraceId”>>,longstr,<<“31b1b0a9699c2d3f”>>},
{<<“X-B3-SpanId”>>,longstr,<<“55083fa909f05ab2”>>}]},
{<<“content_encoding”>>,longstr,<<“UTF-8”>>},
{<<“content_type”>>,longstr,<<“text/plain”>>}]
Payload:
bbbbbbbbbbbbbb
接收
================================================================================
2019-11-13 7:10:14:036: Message received
Node: rabbit@hkgi-PC
Connection: 127.0.0.1:12452 -> 127.0.0.1:5672
Virtual host: testhost
User: admin
Channel: 1
Exchange:
Routing keys: [<<“OrderQueue1”>>]
Queue: OrderQueue1
Properties: [{<<“priority”>>,signedint,0},
{<<“delivery_mode”>>,signedint,2},
{<<“headers”>>,table,
[{<<“X-B3-ParentSpanId”>>,longstr,<<“31b1b0a9699c2d3f”>>},
{<<“X-B3-Sampled”>>,longstr,<<“1”>>},
{<<“spring_listener_return_correlation”>>,longstr,
<<“c5d011b7-3052-4186-89a7-1708a3a8ebac”>>},
{<<“X-B3-TraceId”>>,longstr,<<“31b1b0a9699c2d3f”>>},
{<<“X-B3-SpanId”>>,longstr,<<“55083fa909f05ab2”>>}]},
{<<“content_encoding”>>,longstr,<<“UTF-8”>>},
{<<“content_type”>>,longstr,<<“text/plain”>>}]
Payload:
bbbbbbbbbbbbbb
进入rabbitmq的sbin文件夹。我的目录为D:\Program Files\RabbitMQ Server\rabbitmq_server-3.8.5\sbin,打开cmd窗口,执行如下命令。然后重启mq
rabbitmq-plugins disable rabbitmq_tracing