Skip to main content

VMware Aria Operations for Applications Pyformance Library

Project description

wavefront-pyformance

GitHub Actions PyPI - Version PyPI - License PyPI - Python Versions PyPI - Downloads

This is a plugin for pyformance which adds VMware Aria Operations™ for Applications (formerly known as 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.

Note: We're in the process of updating the product name to Operations for Applications, but in many places we still refer to it as Wavefront.

Requirements

Python 3.x are supported.

pip install wavefront-pyformance

Usage

Wavefront Reporter

The Wavefront Reporters support tagging at the host level. If you pass a tag through a reporter, the reporter tags the metrics before sending the metrics to our service.

Create a Reporter

You can create a WavefrontProxyReporter or WavefrontDirectReporter as follows:

import pyformance
from wavefront_pyformance import wavefront_reporter

reg = pyformance.MetricsRegistry()

# report metrics to a Wavefront proxy every 60s
wf_proxy_reporter = wavefront_reporter.WavefrontProxyReporter(
    host=host,  # required
    port=2878,  # default: 2878
    source='wavefront-pyformance-example',  # default: 'wavefront-pyformance'
    registry=reg,  # default: None
    reporting_interval=60,  # default: 60
    prefix='python.proxy.',  # default: 'proxy.'
    tags={'key1': 'val1',
          'key2': 'val2'},
    enable_runtime_metrics: False,  # default: False
    enable_internal_metrics: True)  # default: True
wf_proxy_reporter.start()

# report metrics directly to a Wavefront server every 60s
wf_direct_reporter = wavefront_reporter.WavefrontDirectReporter(
    server=server,  # required
    token=token,  # required
    source='wavefront-pyformance-example',  # default: 'wavefront-pyformance'
    registry=reg,  # default: None
    reporting_interval=60,  # default: 60
    clock=None,  # default: None
    prefix='python.direct.',  # default: 'direct.'
    tags={'key1': 'val1',
          'key2': 'val2'},  # default: None
    enable_runtime_metrics=False,  # default: False
    enable_internal_metrics=False)  # default: False
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 immediately
wf_reporter.report_now()

# Stop Wavefront Reporter
wf_reporter.stop()

Delta Counter

To create a Wavefront delta counter:

import pyformance
from wavefront_pyformance import delta

reg = pyformance.MetricsRegistry()
d_0 = delta.delta_counter(reg, 'requests_delta')
d_0.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:

import pyformance
from wavefront_pyformance import wavefront_histogram

reg = pyformance.MetricsRegistry()
h_0 = wavefront_histogram.wavefront_histogram(reg, 'requests_duration')
h_0.add(10)

Python Runtime Metrics

To enable Python runtime metrics reporting, set the enable_runtime_metrics flag to True:

    wf_proxy_reporter = wavefront_reporter.WavefrontProxyReporter(
        host=host,
        port=2878,
        registry=reg,
        source='runtime-metric-test',
        tags={'global_tag1': 'val1',
              'global_tag2': 'val2'},
        prefix='python.proxy.',
        enable_runtime_metrics=True).report_minute_distribution()

    wf_direct_reporter = wavefront_reporter.WavefrontDirectReporter(
        server=server,
        token=token,
        registry=reg,
        source='runtime-metric-test',
        tags={'global_tag1': 'val1',
              'global_tag2': 'val2'},
        prefix='python.direct.',
        enable_runtime_metrics=True).report_minute_distribution()

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-1.2.3.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wavefront_pyformance-1.2.3-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wavefront-pyformance-1.2.3.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for wavefront-pyformance-1.2.3.tar.gz
Algorithm Hash digest
SHA256 2bf9eb137249868d4b083d280302a96ef75f83676abbd9ea0277c796b564fcbf
MD5 08b538e13c9ba4cbafd196e9f4b88137
BLAKE2b-256 d11b9163c02efc57c04f3c80358db5c42fe834bf1a6ae4c72427ca7806276ee0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wavefront_pyformance-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 352715fd192c77e0810cd4d0e94363160390448bcbbf71bdb9f932ff4e6baab5
MD5 45a3c52f360127ebd06f202eed8e6b64
BLAKE2b-256 eca0a071e2dced79bca0f2f3b5c1e0cc2b0484ffc05d916b872d484d93f6e9e8

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