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

von

> 编程语言
开源

Von 是一个意见强烈的 Redis 统计跟踪工具

173 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

Von 是一个意见强烈的 Redis 统计跟踪工具

Von

Von is an opinionated Redis stats tracker. It works with keys, you choose one, Von increments it. It has a few built in conveniences:

Requirements

Von uses Redis for storing counters so you'll need it get going. If you're on OS X you can use homebrew:

bash
$ brew install redis

Auto Incrementing Parent Keys

Keys are namespaced and every parent key is incremented when you increment a child key, for example:

ruby
Von.increment('downloads')          # bumps the 'downloads' key 1 time
Von.increment('downloads:app123')   # bumps the 'downloads:app123' key 1 time AND the 'downloads' key 1 time

Tracking Time Periods

By default Von will only bump a "total" counter for the given key. This is great, but what makes Von really useful is that it can be configured to group certain keys by hour, day, week, month, and year. And you can set limits on how many of each you want to keep around. Here's how it works:

Configuring Time Periods

ruby
Von.configure do |config|
    # Keep daily stats for 30 days
    config.counter 'downloads', daily: 30

    # Keep monthly stats for 3 months and yearly stats for 2 years
    config.counter 'uploads', monthly: 3, yearly: 2
end

Tracking the Current Time Period

If just wanna track stats on the current minute/hour/day/week/etc, you can set that up pretty easily with Von:

ruby
Von.configure do |config|
    # Track downloads stats for the current hour
    config.counter 'downloads', current: :hour

    # Track page views for the current day and week
    config.counter 'page-views', current: [ :day, :week ]
end

Tracking "Bests"

Time periods are pretty cool, but sometimes you wanna know when you did your best. You can track these with Von as well:

ruby
Von.configure do |config|
    # Track the best day for downloads
    config.counter 'downloads', best: :day

    # Track the best hour and week for page views
    config.counter 'page-views', best: [ :hour, :week ]
end

Incrementing

Once you've configured the keys you don't have to do anything special, just increment the key, Von will handle this rest.

ruby
Von.increment('downloads')
Von.increment('uploads')
Von.increment('page-views')

Getting Stats

…

One nice thing to note, if you're counting a time period and there wasn't a value stored for the particular hour/day/week/etc, it'll be populated with a zero, this ensures that if you want 30 days of stats, you get 30 days of stats.

Configuration

There are a few things you might want to configure in Von, you can do this in the configure block where you would also set time periods and expirations.

…

Installation

Add this line to your application's Gemfile:

gem 'von'

And then execute:

$ bundle

Or install it yourself as:

$ gem install von

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Issues· 8 开放

查看全部 Issues在 GitHub 打开

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

> 标签

Ruby

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

> 工具信息

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

> 相关工具

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