logstash-plugins / logstash-output-rabbitmq

Apache License 2.0
17 stars 37 forks source link

Setting message properties when publishing #6

Open magnusbaeck opened 9 years ago

magnusbaeck commented 9 years ago

It should be possible to set arbitrary message properties when publishing messages via a rabbitmq output. Some properties (like timestamp and possibly content-type) should perhaps be set by default while others should always be optional. See a recent StackOverflow question for an example of why this can be useful.

andrewvc commented 9 years ago

@magnusbaeck this is a great suggestion, I will try and find some time for it next week

C-Duv commented 7 years ago

I guess message headers could be added at the same time ;)

LeonardoBonacci commented 6 years ago

Hello,

I'm currently implementing spring cloud's Sleuth and Zipkin. https://spring.io/blog/2016/02/15/distributed-tracing-with-spring-cloud-sleuth-and-spring-cloud-zipkin

Tracing information of RabbitMQ communication between Spring Micro Services comes out of the box. However, in the center of my application I use LogStash with its RabbitMQ input and out plugin. Unfortunately, here tracing becomes impossible.

Using LogStash's input RabbitMQ plugin I can capture the necessary header information (see data below). These id's are needed as RabbitMQ output header fields if I am to further track the communication between micro services.

So far I only see functionality to write/send properties. Could it be (made) possible to send header fields too?

"@metadata" => { "rabbitmq_headers" => { "contentType" => "text/plain", "spanSampled" => "1", "messageSent" => true, "spanTraceId" => "b2decb6421a62302", "spanId" => "86f067dae2d06fe5", "spanName" => "message:some-message", "originalContentType" => "application/json;charset=UTF-8", "nativeHeaders" => { "spanSampled" => [ [0] "1" ], "spanTraceId" => [ [0] "b2decb6421a62302" ], "spanId" => [ [0] "86f067dae2d06fe5" ], "spanName" => [ [0] "message:some-message" ], "spanParentSpanId" => [ [0] "b2decb6421a62302" ] }, "spanParentSpanId" => "b2decb6421a62302" }, "rabbitmq_properties" => { "priority" => 0, "consumer-tag" => "amq.ctag-LTqa6j15LxfPS5Kixf7WLQ", "content-type" => "text/plain", "delivery-mode" => 2, "exchange" => "some-exchange", "routing-key" => "some-key" }