Skip to content

Include set functionality #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions README.mkd → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,29 @@ An nginx module for sending statistics to statsd.
This is how to use the nginx-statsd module:

http {

# Set the server that you want to send stats to.
statsd_server your.statsd.server.com;

# Randomly sample 10% of requests so that you do not overwhelm your statsd server.
# Defaults to sending all statsd (100%).
# Defaults to sending all statsd (100%).
statsd_sample_rate 10; # 10% of requests


server {
listen 80;
server_name www.your.domain.com;
# Increment "your_product.requests" by 1 whenever any request hits this server.

# Increment "your_product.requests" by 1 whenever any request hits this server.
statsd_count "your_product.requests" 1;

# send set to statsd to count unique visitors, the metric should be a dynamic property
# Here I use the $remote_addr variable from nginx to register the request from a unique IP
# Argument must be a String
statsd_set "your_unique_metric" "$remote_addr";

location / {

# Increment the key by 1 when this location is hit.
statsd_count "your_product.pages.index_requests" 1;

Expand All @@ -37,7 +42,7 @@ This is how to use the nginx-statsd module:

# Increment a key based on the value of a custom header. Only sends the value if
# the custom header exists in the upstream response.
statsd_count "your_product.custom_$upstream_http_x_some_custom_header" 1
statsd_count "your_product.custom_$upstream_http_x_some_custom_header" 1
"$upstream_http_x_some_custom_header";

proxy_pass http://some.other.domain.com;
Expand Down
Loading