Statsd

From 탱이의 잡동사니
Jump to: navigation, search

Overview

로그 수집 데몬 statsd 내용 정리

Basic

Data Types

statsd 서버는 30초의 간격을 두고 graphite로 데이터를 전송한다. 그리고 graphite 에서는 평균 averaged bucket 에 저장된지 1분이 된 데이터만을 저장하므로, graph 로 나타나는 데이터는 보통 1분이 지난 데이터라고 할 수 있다.

Counters

Counters type 은 가장 기본적인 데이터 타입이다. 지정된 샘플링 시간동안 발생한 지정된 이벤트의 갯수를 나타내는데 사용된다.

예를 들어 샘플링 시간이 10초이고, 10초 동안 발생한 이벤트(지정된 이벤트)의 갯수가 7번이라고 한다면, counters 의 값은 0.7 이 된다.

Timers

Timers are meant to track how long something took. They are an invaluable tool for tracking application performance.

The statsd server collects all timers under stats.timers prefix, and will calculate the lower bound, mean, 90th percentile, upper bound, and count of each timer for each period(by the time you see it in Graphite, that's usually per minute).

  • The lower bound is the lowest value statsd saw for that stat during that time period.
  • The mean is the average of all values statsd saw for that stat during that time period.
  • The 90th percentile is a value x such that 90% of all the values statsd saw for that stat during that time period are below x, and 10% are above. This is a great number to try to optimize.
  • The upper bound is the highest value statsd saw for that during that time period.
  • The count is the number of timings statsd saw for that stat during that time period. It is not averaged.

Gauges

Gauges are a constant data type. They are not subject to averaging, and they don't change unless you change them. That is, once you set a gauge value, it will be a flat line on the graph until you change it again.

Gauges are useful for things that are already averaged, or don't need to reset periodically. System load, for example, could be graphed with a gauge.

The statsd server collects gauges under the stats.gauges perfix.

Sets

Sets count the number of unique values passed to a key.

If the method is called multiple times with the same value in the same sample period, that value will only be counted once.

c.set('users', 'foo')
c.set('users', 'bar')

See also