百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
N

nginx-statsd

> 编程语言
开源

一个用于向 statsd 发送统计信息的 nginx 模块。

366 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一个用于向 statsd 发送统计信息的 nginx 模块。

nginx-statsd

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%). 
	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. 
		statsd_count "your_product.requests" 1;

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

			# Increment the key by 1, but only if $request_completion is set to something.
			statsd_count "your_product.pages.index_responses" 1 "$request_completion";

			# Send a timing to "your_product.pages.index_response_time" equal to the value
			# returned from the upstream server. If this value evaluates to 0 or empty-string,
			# it will not be sent. Thus, there is no need to add a test.
			statsd_timing "your_product.pages.index_response_time" "$upstream_response_time";

			# 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 
				"$upstream_http_x_some_custom_header";

			proxy_pass http://some.other.domain.com;
		}
	}
}

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言