Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Python syntax highlighting in the readme file #10

Merged
merged 1 commit into from Dec 16, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 27 additions & 9 deletions README.rst
Expand Up @@ -19,7 +19,9 @@ API
Gauge Gauge
----- -----


A gauge is an instantaneous measurement of a value :: A gauge is an instantaneous measurement of a value

.. code-block:: python


class JobGauge(metrology.instruments.Gauge): class JobGauge(metrology.instruments.Gauge):
def value(self): def value(self):
Expand All @@ -30,7 +32,9 @@ A gauge is an instantaneous measurement of a value ::
Counters Counters
-------- --------


A counter is like a gauge, but you can increment or decrement its value :: A counter is like a gauge, but you can increment or decrement its value

.. code-block:: python


counter = Metrology.counter('pending-jobs') counter = Metrology.counter('pending-jobs')
counter.increment() counter.increment()
Expand All @@ -41,7 +45,9 @@ Meters
------ ------


A meter measures the rate of events over time (e.g., "requests per second"). A meter measures the rate of events over time (e.g., "requests per second").
In addition to the mean rate, you can also track 1, 5 and 15 minutes moving averages :: In addition to the mean rate, you can also track 1, 5 and 15 minutes moving averages

.. code-block:: python


meter = Metrology.meter('requests') meter = Metrology.meter('requests')
meter.mark() meter.mark()
Expand All @@ -50,7 +56,9 @@ In addition to the mean rate, you can also track 1, 5 and 15 minutes moving aver
Timers Timers
------ ------


A timer measures both the rate that a particular piece of code is called and the distribution of its duration :: A timer measures both the rate that a particular piece of code is called and the distribution of its duration

.. code-block:: python


timer = Metrology.timer('responses') timer = Metrology.timer('responses')
with timer: with timer:
Expand All @@ -60,16 +68,20 @@ A timer measures both the rate that a particular piece of code is called and the
Utilization Timer Utilization Timer
----------------- -----------------


A specialized timer that calculates the percentage of wall-clock time that was spent :: A specialized timer that calculates the percentage of wall-clock time that was spent


.. code-block:: python

utimer = Metrology.utilization_timer('responses') utimer = Metrology.utilization_timer('responses')
with utimer: with utimer:
do_something() do_something()


Profilers Profilers
--------- ---------


A profiler measures the distribution of the duration passed in a every part of the code :: A profiler measures the distribution of the duration passed in a every part of the code

.. code-block:: python


profiler = Metrology.profiler('slow-code') profiler = Metrology.profiler('slow-code')
with profiler: with profiler:
Expand All @@ -82,7 +94,9 @@ Reporters
Logger Reporter Logger Reporter
--------------- ---------------


A logging reporter that write metrics to a logger :: A logging reporter that write metrics to a logger

.. code-block:: python


reporter = LoggerReporter(level=logging.INFO, interval=10) reporter = LoggerReporter(level=logging.INFO, interval=10)
reporter.start() reporter.start()
Expand All @@ -91,7 +105,9 @@ A logging reporter that write metrics to a logger ::
Graphite Reporter Graphite Reporter
----------------- -----------------


A graphite reporter that send metrics to graphite :: A graphite reporter that send metrics to graphite

.. code-block:: python


reporter = GraphiteReporter('graphite.local', 2003) reporter = GraphiteReporter('graphite.local', 2003)
reporter.start() reporter.start()
Expand All @@ -100,7 +116,9 @@ A graphite reporter that send metrics to graphite ::
Librato Reporter Librato Reporter
---------------- ----------------


A librator metric reporter that send metrics to librato API :: A librator metric reporter that send metrics to librato API

.. code-block:: python


reporter = LibratoReporter("<email>", "<token>") reporter = LibratoReporter("<email>", "<token>")
reporter.start() reporter.start()
Expand Down