Skip to content

Instantly share code, notes, and snippets.

@ericmustin
Created August 24, 2020 16:09
Show Gist options
  • Save ericmustin/808576cf8f32d1349aaac90ba658833d to your computer and use it in GitHub Desktop.
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
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