Skip to main content

The Datadog Python library

Project description

The Datadog Python library

Build Status Documentation Status PyPI - Version PyPI - Downloads

Datadogpy is a collection of tools suitable for inclusion in existing Python projects or for development of standalone scripts. It provides an abstraction on top of Datadog's raw HTTP interface and the Agent's StatsD metrics aggregation server, to interact with Datadog and efficiently report events and metrics.

For usage of StatsD metrics, the Agent must be running and available.

See CHANGELOG.md for changes.

Installation

To install from pip:

pip install datadog

To install from source:

python setup.py install

Quick Start Guide

# Configure the module according to your needs
from datadog import initialize

options = {
    'api_key':'api_key',
    'app_key':'app_key'
}

initialize(**options)

# Use Datadog REST API client
from datadog import api

title = "Something big happened!"
text = 'And let me tell you all about it here!'
tags = ['version:1', 'application:web']

api.Event.create(title=title, text=text, tags=tags)


# Use Statsd, a Python client for DogStatsd
from datadog import statsd

# Uncomment to set namespace or add tags to everything
# statsd.namespace = 'localdev'
# statsd.constant_tags = ['testing', 'dogstats']

statsd.increment('whatever')
statsd.gauge('foo', 42)

# Or ThreadStats, an alternative tool to collect and flush metrics, using Datadog REST API
from datadog import ThreadStats
stats = ThreadStats()
stats.start()
stats.increment('home.page.hits')

Thread Safety

DogStatsD and ThreadStats are thread-safe.

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

datadog-0.28.0.tar.gz (73.7 kB view details)

Uploaded Source

Built Distribution

datadog-0.28.0-py2.py3-none-any.whl (72.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file datadog-0.28.0.tar.gz.

File metadata

  • Download URL: datadog-0.28.0.tar.gz
  • Upload date:
  • Size: 73.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for datadog-0.28.0.tar.gz
Algorithm Hash digest
SHA256 eb6f2707151be8851f7da3768e605ac92ec45464fc48d5a878d0b6e08610dd8b
MD5 9a786e3e5def49a2f3371557adcea2e6
BLAKE2b-256 70506f90305b44fa544656a4784d208caff3883498dfddae2ff4f0dcf17354f6

See more details on using hashes here.

File details

Details for the file datadog-0.28.0-py2.py3-none-any.whl.

File metadata

  • Download URL: datadog-0.28.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 72.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for datadog-0.28.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f0c3260654cf1c9a4a610aee6282ee62688e734f7d59ebc830560ca0cc0ef81d
MD5 a5ffd57d419332731db386726d65006a
BLAKE2b-256 d0804f228325a92e5e8327db9c4cf171282c2314fc8a0083d8415d9ed99717b8

See more details on using hashes here.

Supported by

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