Logoj0ke.net Open Build Service > Projects > internetx:projects:http > nginx > nginx-statsd.conf-sample
Sign Up | Log In

File nginx-statsd.conf-sample of Package nginx

 
1
http {
2
3
    # Set the server that you want to send stats to.
4
    statsd_server your.statsd.server.com;
5
6
    # Randomly sample 10% of requests so that you do not overwhelm your statsd server.
7
    # Defaults to sending all statsd (100%). 
8
    statsd_sample_rate 10; # 10% of requests
9
10
11
    server {
12
        listen 80;
13
        server_name www.your.domain.com;
14
15
        # Increment "your_product.requests" by 1 whenever any request hits this server. 
16
        statsd_count "your_product.requests" 1;
17
18
        location / {
19
20
            # Increment the key by 1 when this location is hit.
21
            statsd_count "your_product.pages.index_requests" 1;
22
23
            # Increment the key by 1, but only if $request_completion is set to something.
24
            statsd_count "your_product.pages.index_responses" 1 "$request_completion";
25
26
            # Send a timing to "your_product.pages.index_response_time" equal to the value
27
            # returned from the upstream server. If this value evaluates to 0 or empty-string,
28
            # it will not be sent. Thus, there is no need to add a test.
29
            statsd_timing "your_product.pages.index_response_time" "$upstream_response_time";
30
31
            # Increment a key based on the value of a custom header. Only sends the value if
32
            # the custom header exists in the upstream response.
33
            statsd_count "your_product.custom_$upstream_http_x_some_custom_header" 1 
34
                "$upstream_http_x_some_custom_header";
35
36
            proxy_pass http://some.other.domain.com;
37
        }
38
    }
39
}