make this work with statsd and be awesome

Issue #3 open
andycjw
created an issue

it would be great if this thing can work together with statsd https://github.com/etsy/statsd

I can join this effort if needed

Comments (4)

  1. Boaz Leskes repo owner

    Sounds great and from what I see not to hard to report things to statsd.

    There is one conceptual hurdle - pycounters aggregates data and reports the average (max,min,total). From my understanding statsd does the same. What is a good way to send pycounters' data to statsd?

    Perhaps it would have if you write a short example for what you expect to send to statsd for the simple example mentioned in pycounters docs:

    from pycounters.shortcuts import frequency
    
    @frequency()
    def f():
        """ some interesting work like serving a request """
        pass
    

    and:

    from pycounters.shortcuts import time
    
    @time()
    def f():
        """ some interesting work like serving a request """
        pass
    
  2. Anonymous

    I haven't dive into the code of pycounters yet, but I would imagine decorators like @freQuency and @Георгий Милославский would send the collected data directly to statsd without doing any aggregations on the data if it's setup with statsd as reporter backend

    import pycounters
    
    reporter=pycounters.reporters.StatsReporter()
    pycounters.register_reporter(reporter)
    

    and the reporter will sends data directly to statsd

  3. Boaz Leskes repo owner

    Hi,

    The suggested way will be hard to implement. The are two main reasons:

    1. The counters collect data they need based on the metrics they measure. This potentially mean they destroy the data which means we can't send it to statsd
    2. The save on performance and aggregation all reporters receive an aggregated output from all counters on all processes. This means that by the time the StatsReporter kicks in there is only aggregated data.

    Boaz

  4. Log in to comment