Translator's Note:
Quietly and quietly pynba came out . It is strange that the Habré did not write about it yet :)
What is it:
Pynba is a WSGI interlayer for
pinba . With it, you can collect statistics / monitor the server using the MySQL interface to read data.
It accumulates data from the Python processes, sends them via the UDP protocol and shows statistics in a beautiful, human-readable form of simple reports. It also provides read-only access to raw data, which allows, for example, to create more detailed reports.
')
Users can also measure the work of important parts of the code using timers with arbitrary labels.
Why not another statistics handler?
Because Pinba is cool!
At
IsCool Entertainment, we already use Pinba to monitor our PHP applications.
Requirements
The library requires
Pinba ,
Protobuf and
Werkzeug .
The installation process itself requires
setuptools .
If not, please install it.
Customization
If you are using the official version, just do:
$ pip install iscool_e.pynba
If you prefer the current (developing) version, then
$ git clone https://github.com/IsCoolEntertainment/pynba.git $ python setup.py install
Using
Tell me where your main WSGI program is:
def app(environ, start_response): ...
Import the pynba decorator and decorate the main WSGI application with it.
from iscool_e.pynba import monitor @monitor(('127.0.0.1', 30002)) def app(environ, start_response): ...
Each time your program starts, a UDP stream will be sent.
Ultimately, you can use timers to measure critical areas of your code. To do this, simply import the pynba proxy and use it to create new timers:
from iscool_e.pynba import pynba timer = pynba.timer(foo="bar") timer.start() ... timer.stop()
Differences from PHP extension
In the data sent:
In timers:
- The Python version allows you to set multiple values for each label. Just specify any sequence, mapping or callable. This example:
pynba.timer(foo='bar', baz=['seq1', 'seq2'], qux={'map1': 'val1'})
will generate 4 values for three labels in the Pinba database:
('foo', 'bar'), ('baz', 'seq1'), ('baz', 'seq2'), ('qux.map1', 'val1')
License
The package is distributed under the MIT License. Please read
LICENSE for a full description.