Skip to main content

Library for posting metrics to a server

Project description

A python library to send application metrics using UDP.

Build Status

Installation

pip install measures

Usage

  • count

from measures import Measure
measure = Measure('myclient', ('localhost', 1984))
measure.count('mymetric', dimensions={'name': 'john'})
  • time (measure time spent on a given block)

import time
from measures import Measure
measure = Measure('myclient', ('localhost', 1984))
with measure.time('mymetric'):
    # do some slow operation:
    time.sleep(3.14159)
import time
from measures import Measure
measure = Measure('myclient', ('localhost', 1984))
with measure.time('mymetric') as dimensions:
    # do some slow operation:
    time.sleep(1.61803)
    # add any relevant information, if necessary:
    dimensions['relevant_info'] = 'pertinent_info'
  • send

from measures import Measure
measure = Measure('myclient', ('localhost', 1984))
dimensions = {
    'time': 10.1,
    'relevant_info': pertinent_info
}
measure.send('mymetric', dimensions)

Contributing

  • Set up your environment

git clone https://github.com/globocom/measures.git
cd measures
mkvirtualenv measures
pip install -r test_requirements.txt
  • Run the tests

make tests
  • Write tests for your new feature or bug fix

  • Write needed code changes

  • Iterate, have fun :)

  • Make a pull request with your changes

Who do I talk to?

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

measures-1.3.0.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file measures-1.3.0.tar.gz.

File metadata

  • Download URL: measures-1.3.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for measures-1.3.0.tar.gz
Algorithm Hash digest
SHA256 ba7297d8ac87fe389c0c64b7067b7b92f4e116a03623ffd0c6fab5e6657c4fff
MD5 c235bbea30703761ef4a4d2425ca847c
BLAKE2b-256 f6cd6b4849373a624768134c43306348cc2d5b1c220f12d201f2fda618e99e24

See more details on using hashes here.

Supported by

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