Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yano3/http-status-counter
Count and output sent http status code using mruby code.
https://github.com/yano3/http-status-counter
ngx-mruby
Last synced: 30 days ago
JSON representation
Count and output sent http status code using mruby code.
- Host: GitHub
- URL: https://github.com/yano3/http-status-counter
- Owner: yano3
- Created: 2016-04-05T10:13:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-07-29T13:27:35.000Z (over 4 years ago)
- Last Synced: 2023-04-12T11:53:12.981Z (over 1 year ago)
- Topics: ngx-mruby
- Language: Ruby
- Size: 26.4 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# http-status-counter
Count and output sent http status code using mruby code.
## Configuration
### nginx
```nginx
http {
mruby_init /path/to/nginx/conf.d/status_counter/status_counter_init.rb cache;server {
location / {
mruby_log_handler /path/to/nginx/conf.d/status_counter/status_counter.rb cache;
}location /status_count {
mruby_content_handler /path/to/nginx/conf.d/status_counter/status_counter_output.rb cache;
}
}
}
``````shell
$ curl http://localhost/status_count | jq
{
"requests": 6218,
"status": {
"200": 3344,
"301": 1192,
"302": 901,
"404": 781
},
"body_bytes_sent": 5200307169,
"request_time": 379091,
"avg_request_time": 61.084822695035,
"upstream_response_time": 351707,
"avg_upstream_response_time": 57.210212765957
}
```## use case
- [mackerel-plugin-http-status-counter](https://github.com/yano3/mackerel-plugin-http-status-counter)
## dependent mrbgem
```ruby
conf.gem :github => 'matsumotory/mruby-localmemcache'
conf.gem :github => 'matsumotory/mruby-mutex'
conf.gem :github => 'mattn/mruby-json'
```