Created
September 20, 2012 07:56
-
-
Save b3cft/3754524 to your computer and use it in GitHub Desktop.
Add header to requests on a sample rate
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
// at head of vcl | |
C{ | |
static __thread struct drand48_data random_seed; | |
static long int sample_rate = 1000; | |
}C | |
// in vcl recv | |
C{ | |
long int r; | |
lrand48_r(&random_seed, &r); | |
if (0 == r % sample_rate) { | |
// add header | |
} | |
}C |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment