cyberdelia / metrology

A library to easily measure what's going on in your python.
https://metrology.readthedocs.org
MIT License
309 stars 25 forks source link

Missing @property annotation on example code in Gauge Instrument #16

Closed Neurones67 closed 11 years ago

Neurones67 commented 11 years ago

in Gauge class defined in metrology/instruments/gauge.py, the doc provides this example code:

  class JobGauge(metrology.instruments.Gauge):
      def value(self):
          return len(queue)

This example doesn't work if use a Reporter like GraphicReporter that need "value" to be a property, we need to add the @property annotation to make it work.

Please update the doc of this class with the following:

A gauge is an instantaneous measurement of a value ::

  class JobGauge(metrology.instruments.Gauge):
      @property
      def value(self):
          return len(queue)

  gauge = Metrology.gauge('pending-jobs', JobGauge())

Thank you