Skip to main content

Python helpers to populate and get counters, anywhere in the code

Project description

pysolmeters

Welcome to pysol

Copyright (C) 2013/2017 Laurent Labatut / Laurent Champagnac

pysolmeters is a set of python helpers to populate and get counters, anywhere in the code.

It can be used to instrument low-level APIs and validate stuff with unit testing or push counters toward some monitoring softwares.

Internally, it uses AtomicIntSafe, AtomicFloatSafe and DelayToCountSafe classes, wrapped by a static class Meters, which exposes helper methods.

Usage

To increment integers and floats :

Meters.aii("int_counter")
Meters.afi("float_counter")

To get integers and floats :

vi = Meters.aig("int_counter")
vf = Meters.afg("float_counter")

To put millis toward DelayToCount :

Meters.dtci("dtc1", 0.5)

To get DelayToCount instance

dtc1 = Meters.dtcg("dtc1")

To write all counters to logger :

Meters.write_to_logger()

To reset all counters :

Meters.reset()

Source code

  • We are pep8 compliant (as far as we can, with some exemptions)
  • We use a right margin of 360 characters (please don't talk me about 80 chars)
  • All unittest files must begin with test_ or Test, should implement setUp and tearDown methods
  • All tests must adapt to any running directory
  • The whole project is backed by gevent (http://www.gevent.org/)
  • We use docstring (:return, :rtype, :param, :type etc..), they are mandatory
  • We use PyCharm "noinspection", feel free to use them

Requirements

  • Debian 8 Jessie or greater, x64, Python 2.7

Unittests

To run unittests, you will need:

  • nothing special except python and dependencies requirements.

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysolmeters-1.1.10.tar.gz (22.7 kB view details)

Uploaded Source

File details

Details for the file pysolmeters-1.1.10.tar.gz.

File metadata

  • Download URL: pysolmeters-1.1.10.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

File hashes

Hashes for pysolmeters-1.1.10.tar.gz
Algorithm Hash digest
SHA256 41c9b0dc4df56d7b777fa07dab0e5af1952b841fe6fdef712dcef0193d82b170
MD5 77a00c5bc9fca2936fdb6a52c83cd840
BLAKE2b-256 8b4f93b841033f07a8dc05865e16f52ce383dfb3b4e38a53689ec505446ba8f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page