Giter Club home page Giter Club logo

dogstatsd-python's Introduction

dogstatsd-python

A DogStatsd Python client.

Build Status

Quick Start Guide

First install the library with pip or easy_install

# Install in system python ...
sudo easy_install dogstatsd-python

# .. or into a virtual env
easy_install  dogstatsd-python

Then start instrumenting your code:

# Import the module.
from statsd import statsd

# Optionally, configure the host and port if you're running Statsd on a
# non-standard port.
statsd.connect('localhost', 8125)

# Increment a counter.
statsd.increment('page.views')

# Record a gauge 50% of the time.
statsd.gauge('users.online', 123, sample_rate=0.5)

# Sample a histogram.
statsd.histogram('file.upload.size', 1234)

# Time a function call.
@statsd.timed('page.render')
def render_page():
    # Render things ...

# Tag a metric.
statsd.histogram('query.time', 10, tags = ["version:1"])

You can also post events to your stream. You can tag them, set priority and even aggregate them with other events.

Aggregation in the stream is made on hostname/event_type/source_type/aggregation_key.

# Post a simple message
statsd.event("There might be a storm tomorrow", "A friend warned me earlier.")

# Cry for help
statsd.event("SO MUCH SNOW", "Started yesterday and it won't stop !!", alert_type = "error", tags = ["urgent", "endoftheworld"])

Documentation

Read the full API docs here.

Feedback

To suggest a feature, report a bug, or general discussion, head over here.

Change Log

  • 0.5.3
    • Add support for service checks
  • 0.5.2
    • Recreate a socket on SocketError to not stay stuck
  • 0.5.1
    • Add support for batch sending metrics
  • 0.5.0
    • Encode Binary payload with UTF-8
  • 0.4.1
    • Re-add global statsd instance (thanks to @Julian).
  • 0.4.0
    • Added support for sending events.
  • 0.3.0
    • Uses a connected socket for a big performance improvement (thanks to @Julian).
    • Use connect to override the host and port of a statsd instance.
  • 0.2.1
    • Fixed the timed decorator, to ensure it preserves function attributes.
  • 0.2
    • Added the set metric type.
  • 0.1
    • Initial version of the code

License

Copyright (c) 2015 Datadog Inc.

dogstatsd-python's People

Contributors

adrienjt avatar alq666 avatar bunelr avatar cenkalti avatar clofresh avatar clutchski avatar conorbranagan avatar dcrosta avatar elijahandrews avatar julian avatar lotharsee avatar miketheman avatar remh avatar robbles avatar stanhu avatar yannmh avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.