From 8ab4d4e1370782f00215033b8f2d726128d4cc5e Mon Sep 17 00:00:00 2001 From: Jorg Heymans Date: Sat, 24 Oct 2020 20:53:37 +0200 Subject: [PATCH 1/3] adding note about propagation from apache reverse proxy --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 928b026..355f271 100644 --- a/README.md +++ b/README.md @@ -347,3 +347,17 @@ recent and largely contained to Envoy, which already supports B3 single format. Sending a larger second header would increase the pain to others who don't have this problem anyway. Put another way, the few proxies missing B3 single header support should update instead of burdening more people from lack thereof. + +# Showcase: Start propagating from an Apache reverse proxy + +Zipkin users were wondering +if it is possible to start B3 propagation from an Apache reverse proxy. @adammichalik +came up with a clever +way to accomplish this, using Apache modules only: + +``` +RequestHeader setifempty X-B3-TraceId "expr=%{md5:%{reqenv:UNIQUE_ID}}" +RequestHeader edit X-B3-TraceId "^(.{0,16}).*$" "$1" +``` + +>%{reqenv:UNIQUE_ID} is a unique string generated by mod_unique_id. Then, it gets MD5-hashed and assigned to the X-B3-TraceId header. This gives a 32-character hex string = 128 bit traceId. Since my downstream libraries require the traceIds to be 64-bit, the RequestHeader edit extracts the first 16 characters (64 bit) from the value and reassigns it back to the X-B3-TraceId header which is sent downstream. From d0f7e9a8b580aa432ba37c1c8a766e00356385ee Mon Sep 17 00:00:00 2001 From: Jorg Heymans Date: Sat, 24 Oct 2020 20:58:07 +0200 Subject: [PATCH 2/3] wording --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 355f271..5659211 100644 --- a/README.md +++ b/README.md @@ -348,7 +348,7 @@ Sending a larger second header would increase the pain to others who don't have this problem anyway. Put another way, the few proxies missing B3 single header support should update instead of burdening more people from lack thereof. -# Showcase: Start propagating from an Apache reverse proxy +# Showcase: propagation from an Apache reverse proxy Zipkin users were wondering if it is possible to start B3 propagation from an Apache reverse proxy. @adammichalik From 760aed97e8750eb39288d9b9c3137f2cd707f5ac Mon Sep 17 00:00:00 2001 From: Jorg Heymans Date: Mon, 26 Oct 2020 20:46:38 +0100 Subject: [PATCH 3/3] Update README.md Co-authored-by: Adrian Cole --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5659211..251a51e 100644 --- a/README.md +++ b/README.md @@ -351,7 +351,7 @@ support should update instead of burdening more people from lack thereof. # Showcase: propagation from an Apache reverse proxy Zipkin users were wondering -if it is possible to start B3 propagation from an Apache reverse proxy. @adammichalik +if it is possible to start B3 propagation from an Apache reverse proxy. [adammichalik](https://github.com/adammichalik) came up with a clever way to accomplish this, using Apache modules only: