Skip to content

Instantly share code, notes, and snippets.

@nesquena
Forked from alanmackenzie/default.c
Created September 27, 2012 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nesquena/3792184 to your computer and use it in GitHub Desktop.
Save nesquena/3792184 to your computer and use it in GitHub Desktop.
Add X-Request-Start header so we can track queue times in New Relic RPM beginning at Varnish. - Modified by me for varnish 2.X
#
# Add X-Request-Start header so we can track queue times in New Relic RPM beginning at Varnish.
# Taken from https://gist.github.com/494265 & modified to compile on OSX.
#
sub vcl_recv {
// NewRelic X-Request-Start tracking
C{
#include </etc/varnish/newrelic.h>
}C
# ...
}
/*
* Add X-Request-Start header so we can track queue times in New Relic RPM beginning at Varnish.
* Taken from https://gist.github.com/494265 & modified to compile on OSX.
* Also check out http://www.paoloiannelli.com/2012/09/26/working-varnish-configuration-for-new-relic/
*/
#include <sys/time.h>
#include <stddef.h>
#include <stdio.h>
struct timeval detail_time;
gettimeofday(&detail_time, 0);
char start[20];
sprintf(start, "t=%lu%06lu", detail_time.tv_sec, detail_time.tv_usec);
VRT_SetHdr(sp, HDR_REQ, "\020X-Request-Start:", start, vrt_magic_string_end);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment