Skip to content

Override Statistic Utility

Neuron Teckid edited this page Mar 18, 2016 · 1 revision

Redis Ctl uses Open Falcon as the default statistic utility. If you want to override it, you need to define a Client class (class name could also be anything else) with following member functions

  • write_points(self, name, fields)
    • name : Redis or Cerberus address string, generally in HOST:PORT format
    • fields : a dict object contains the statistic data
    • Returns nothing
  • query(self, name, field, aggf, span, end, interval)
    • name : Same as name passed to write_points
    • field : One gauge field
    • aggf : a string, one of MAX, MIN, AVERAGE
    • span : a integer that indicates how many seconds in the stats span
    • end : a integral timestamp that indicates the end of stats span
    • interval : a integer that indicates how many seconds in every two points
    • however, span, end, interval are not strict, you may return less or looser stats data rather than what the caller wanted, and the page will just paint what you gave
    • Returns a list whose elements are tuples of (timestamp, value)

Instantiate an object of such class, and assign it to stats.client in stats/__init__.py.