Skip to content

Asquera/varnish-newrelic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

varnish-newrelic

A small varnish vmod that allows to set the X-Request-Start header for use with New Relic RPM more conveniently. The vmod just encapsulates a small code snippet (found here) and offers a simple function for use in vcl scripts. See example below.

Prerequisites

Dependening on the system setup it might be necessary to install the following packages

For example in Ubuntu:

sudo apt-get install libpcre3-dev libtool

Installation

Download the varnish source. Unpack it to a folder and follow the instructions in the INSTALL file. This should build varnish from source and install it on the system. Varnish needs autoconf and automake installed. In order to compile a varnish module successfully, path variables to the varnish source and the vmods folder are necessary. Either provide them by specifying environment variables.

export VARNISHSRC=path/to/varnish_src
export VMODDIR=/usr/local/lib/varnish/vmods/ # path might differ

or by providing these variables when calling the configure script.

./configure VARNISHSRC=path/to/varnish_src VMODDIR=/usr/local/lib/varnish/vmods/

The following steps install the vmod.

cd vmod
sh autogen.sh
./configure
make
make install

Running the autogen script can result in an error message, stating the "required file ltmain.sh not found". It is suggested to re-run the script a second time.

Example

After the vmod is installed just import the newrelic vmod and can be referenced with the newrelic.set_x_request_start function at different points.

import newrelic;
backend default {
    .host = "127.0.0.1";
    .port = "4567";
}
sub vcl_recv {
    newrelic.set_x_request_start();
}

To check that everything is correctly set up you can start a small test web application from he test folder. It needs Ruby with the sinatra gem insalled. Just start it and should display the time stamp of the X-Request-Start header

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published