Created
August 24, 2020 16:09
-
-
Save ericmustin/808576cf8f32d1349aaac90ba658833d to your computer and use it in GitHub Desktop.
try this one cool trick to do distributed tracing and RUM Injection via VCL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub vcl_recv { | |
declare local var.timemsec TIME; | |
declare local var.traceid INTEGER; | |
if(req.http.x-datadog-trace-id) { | |
} else{ | |
set var.traceid = randomint(0, 2147483647); | |
set var.traceid <<= 32; | |
set var.traceid |= randomint(0, 4294967295); | |
set req.http.X-Datadog-Trace-Id = var.traceid; | |
set req.http.X-Datadog-Origin = "synthetics"; | |
} | |
set req.http.X-Cdn-Start = time.start.msec; | |
} | |
sub vcl_deliver { | |
if(req.http.X-Datadog-Trace-Id) { | |
set resp.http.Server-Timing = req.http.X-Datadog-Trace-Id; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment