Skip to main content

Wavefront Pyformance Library

Project description

wavefront-pyformance

image image image travis build status

This is a plugin for pyformance which adds Wavefront reporters (via proxy or direct ingestion) and an abstraction that supports tagging at the host level. It also includes support for Wavefront delta counters.

Requirements

Python 2.7+ and Python 3.x are supported.

pip install wavefront-pyformance

Usage

Wavefront Reporter

The Wavefront Reporters support tagging at the host level. Tags passed to a reporter will be applied to every metric before being sent to Wavefront.

Create Wavefront Reporter

You can create a WavefrontProxyReporter or WavefrontDirectReporter as follows:

from pyformance import MetricsRegistry
from wavefront_pyformance.wavefront_reporter import WavefrontProxyReporter, WavefrontDirectReporter

reg = MetricsRegistry()

# report metrics to a Wavefront proxy every 10s
wf_proxy_reporter = WavefrontProxyReporter(host=host, port=2878, registry=reg,
                                           source="wavefront-pyformance-example",
                                           tags={"key1":"val1", "key2":"val2"},
                                           prefix="python.proxy.",
                                           reporting_interval=10)
wf_proxy_reporter.start()

# report metrics directly to a Wavefront server every 10s
wf_direct_reporter = WavefrontDirectReporter(server=server, token=token, registry=reg,
                                             source="wavefront-pyformance-exmaple",
                                             tags={"key1":"val1", "key2": "val2"},
                                             prefix="python.direct.",
                                             reporting_interval=10)
wf_direct_reporter.start()

Flush and stop Wavefront Reporter

After create Wavefront Reporter, start() will make the reporter automatically reporting every reporting_interval seconds. Besides that, you can also call report_now() to perform reporting immediately. report_now() should also be called before you stop the reporter as follows:

wf_reporter.report_now()
wf_reporter.stop()

Delta Counter

To create a Wavefront delta counter:

from pyformance import MetricsRegistry
from wavefront_pyformance import delta

reg = MetricsRegistry()
d1 = delta.delta_counter(reg, "requests_delta")
d1.inc(10)

Note: Having the same metric name for any two types of metrics will result in only one time series at the server and thus cause collisions. In general, all metric names should be different. In case you have metrics that you want to track as both a Counter and Delta Counter, consider adding a relevant suffix to one of the metrics to differentiate one metric name from another.

Wavefront Histogram

To create a Wavefront Histogram:

from pyformance import MetricsRegistry
from wavefront_pyformance import wavefront_histogram

reg = MetricsRegistry()
h1 = wavefront_histogram.wavefront_histogram(reg, "requests_duration")
h1.add(10)

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

wavefront-pyformance-0.9.3.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

wavefront_pyformance-0.9.3-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file wavefront-pyformance-0.9.3.tar.gz.

File metadata

  • Download URL: wavefront-pyformance-0.9.3.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 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 wavefront-pyformance-0.9.3.tar.gz
Algorithm Hash digest
SHA256 dadff82934d9390c0b9db06708988115058705922fb3ac9cf365781569479c89
MD5 a5f0dcfa0eaa90dfc15d5874a4779cf7
BLAKE2b-256 0a9c23ba05169757644ad223db4cf88ded6d40369c57b7f8ba5ce1da5b756e6c

See more details on using hashes here.

File details

Details for the file wavefront_pyformance-0.9.3-py3-none-any.whl.

File metadata

  • Download URL: wavefront_pyformance-0.9.3-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 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 wavefront_pyformance-0.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0cd7058acd21f6c90bccd1697e54f7422e253f57c2964da1769bf7ce9f9f6473
MD5 137b55f00e8bc1b40d3558de7173f7d5
BLAKE2b-256 2d24b43b2fb6160680f142fb7275f41db298a5fd3af386639b2de42094521ce4

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