Fork me on GitHub

OstrichNet 简易统计信息收集工具

Ostrich 是twitter用于监控服务器性能的一个scala库,项目地址https://github.com/twitter/ostrich, 主要功能是收集、展示统计信息, 同时也提供了关闭服务器、重新加载配置、 监测服务器有效性等简易控制功能, 以及获取线程、GC、以及Profile等调试和性能信息。GitHub上有一个C#的移植版本OstrichNet,移植版本只支持收集、展示统计信息: https://github.com/ewhauser/OstrichNet

统计信息收集分为counters, gauges, metrics:

1. counter是单调递增的数值, 使用示例:Stats.Incr("counter_name");

2. gauges, 诸如堆使用量, 当前温度等离散的数值。

Stats.Gauge(“current_temperature”, () => tempMonitor.CalculateTemp());

3. metric,  metric主要用于计时, 每个metric记录count, min, max, mean, 90th,以及 柱状图 ,典型的metric有某个api的调用延迟, 服务器带宽占用等。

Stopwatch stopwatch = new Stopwatch();
stopwatch.start();
...code to time...
Stats.Time("db_call", stopwatch);
Stats.Time("db_call"), () => { ... }); 

var dbRows = Stats.Time("db_call"), () => { ... }); 

posted @ 2013-11-30 14:21  张善友  阅读(1321)  评论(0编辑  收藏  举报