wavefront-pyformance


Namewavefront-pyformance JSON
Version 1.2.4 PyPI version JSON
download
home_pagehttps://github.com/wavefrontHQ/wavefront-pyformance
SummaryVMware Aria Operations for Applications Pyformance Library
upload_time2023-08-07 21:42:14
maintainer
docs_urlNone
authorVMware Aria Operations for Applications Team
requires_python
licenseApache-2.0
keywords distributed tracing logging metrics monitoring observability pyformance tracing wavefront wavefront pyformance
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # wavefront-pyformance

[![GitHub Actions](https://github.com/wavefrontHQ/wavefront-pyformance/actions/workflows/main.yml/badge.svg)](https://github.com/wavefrontHQ/wavefront-pyformance/actions)
[![PyPI - Version](https://img.shields.io/pypi/v/wavefront-pyformance)](https://pypi.org/project/wavefront-pyformance)
[![PyPI - License](https://img.shields.io/pypi/l/wavefront-pyformance)](https://pypi.org/project/wavefront-pyformance)
[![PyPI - Python Versions](https://img.shields.io/pypi/pyversions/wavefront-pyformance)](https://pypi.org/project/wavefront-pyformance)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/wavefront-pyformance)](https://pypi.org/project/wavefront-pyformance)


This is a plugin for [pyformance](https://github.com/omergertel/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:

```Python
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.
 ```Python
# Report immediately
wf_reporter.report_now()

# Stop Wavefront Reporter
wf_reporter.stop()
```

### Delta Counter

To create a Wavefront delta counter:

```Python
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](https://docs.wavefront.com/proxies_histograms.html):

```Python
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`:

```Python
    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()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/wavefrontHQ/wavefront-pyformance",
    "name": "wavefront-pyformance",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Distributed Tracing,Logging,Metrics,Monitoring,Observability,PyFormance,Tracing,Wavefront,Wavefront Pyformance",
    "author": "VMware Aria Operations for Applications Team",
    "author_email": "chitimba@wavefront.com",
    "download_url": "https://files.pythonhosted.org/packages/b6/a7/18430feee551c0e0b68c5969b1764d362c8bb692e9be783793908eaf6944/wavefront-pyformance-1.2.4.tar.gz",
    "platform": null,
    "description": "# wavefront-pyformance\n\n[![GitHub Actions](https://github.com/wavefrontHQ/wavefront-pyformance/actions/workflows/main.yml/badge.svg)](https://github.com/wavefrontHQ/wavefront-pyformance/actions)\n[![PyPI - Version](https://img.shields.io/pypi/v/wavefront-pyformance)](https://pypi.org/project/wavefront-pyformance)\n[![PyPI - License](https://img.shields.io/pypi/l/wavefront-pyformance)](https://pypi.org/project/wavefront-pyformance)\n[![PyPI - Python Versions](https://img.shields.io/pypi/pyversions/wavefront-pyformance)](https://pypi.org/project/wavefront-pyformance)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/wavefront-pyformance)](https://pypi.org/project/wavefront-pyformance)\n\n\nThis is a plugin for [pyformance](https://github.com/omergertel/pyformance) which adds VMware Aria Operations\u2122 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.\n\nNote: 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.\n\n## Requirements\nPython 3.x are supported.\n\n```\npip install wavefront-pyformance\n```\n\n## Usage\n\n### Wavefront Reporter\n\nThe 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.\n\n\n\n#### Create a Reporter\nYou can create a `WavefrontProxyReporter` or `WavefrontDirectReporter` as follows:\n\n```Python\nimport pyformance\nfrom wavefront_pyformance import wavefront_reporter\n\nreg = pyformance.MetricsRegistry()\n\n# report metrics to a Wavefront proxy every 60s\nwf_proxy_reporter = wavefront_reporter.WavefrontProxyReporter(\n    host=host,  # required\n    port=2878,  # default: 2878\n    source='wavefront-pyformance-example',  # default: 'wavefront-pyformance'\n    registry=reg,  # default: None\n    reporting_interval=60,  # default: 60\n    prefix='python.proxy.',  # default: 'proxy.'\n    tags={'key1': 'val1',\n          'key2': 'val2'},\n    enable_runtime_metrics: False,  # default: False\n    enable_internal_metrics: True)  # default: True\nwf_proxy_reporter.start()\n\n# report metrics directly to a Wavefront server every 60s\nwf_direct_reporter = wavefront_reporter.WavefrontDirectReporter(\n    server=server,  # required\n    token=token,  # required\n    source='wavefront-pyformance-example',  # default: 'wavefront-pyformance'\n    registry=reg,  # default: None\n    reporting_interval=60,  # default: 60\n    clock=None,  # default: None\n    prefix='python.direct.',  # default: 'direct.'\n    tags={'key1': 'val1',\n          'key2': 'val2'},  # default: None\n    enable_runtime_metrics=False,  # default: False\n    enable_internal_metrics=False)  # default: False\nwf_direct_reporter.start()\n```\n#### Flush and stop Wavefront Reporter\n After create Wavefront Reporter, `start()` will make the reporter automatically reporting every `reporting_interval` seconds.\n Besides that, you can also call `report_now()` to perform reporting immediately.\n ```Python\n# Report immediately\nwf_reporter.report_now()\n\n# Stop Wavefront Reporter\nwf_reporter.stop()\n```\n\n### Delta Counter\n\nTo create a Wavefront delta counter:\n\n```Python\nimport pyformance\nfrom wavefront_pyformance import delta\n\nreg = pyformance.MetricsRegistry()\nd_0 = delta.delta_counter(reg, 'requests_delta')\nd_0.inc(10)\n```\n\nNote: 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.\nIn 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.\n\n### Wavefront Histogram\n\nTo create a [Wavefront Histogram](https://docs.wavefront.com/proxies_histograms.html):\n\n```Python\nimport pyformance\nfrom wavefront_pyformance import wavefront_histogram\n\nreg = pyformance.MetricsRegistry()\nh_0 = wavefront_histogram.wavefront_histogram(reg, 'requests_duration')\nh_0.add(10)\n```\n\n### Python Runtime Metrics\n\nTo enable Python runtime metrics reporting, \nset the `enable_runtime_metrics` flag to `True`:\n\n```Python\n    wf_proxy_reporter = wavefront_reporter.WavefrontProxyReporter(\n        host=host,\n        port=2878,\n        registry=reg,\n        source='runtime-metric-test',\n        tags={'global_tag1': 'val1',\n              'global_tag2': 'val2'},\n        prefix='python.proxy.',\n        enable_runtime_metrics=True).report_minute_distribution()\n\n    wf_direct_reporter = wavefront_reporter.WavefrontDirectReporter(\n        server=server,\n        token=token,\n        registry=reg,\n        source='runtime-metric-test',\n        tags={'global_tag1': 'val1',\n              'global_tag2': 'val2'},\n        prefix='python.direct.',\n        enable_runtime_metrics=True).report_minute_distribution()\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "VMware Aria Operations for Applications Pyformance Library",
    "version": "1.2.4",
    "project_urls": {
        "Homepage": "https://github.com/wavefrontHQ/wavefront-pyformance"
    },
    "split_keywords": [
        "distributed tracing",
        "logging",
        "metrics",
        "monitoring",
        "observability",
        "pyformance",
        "tracing",
        "wavefront",
        "wavefront pyformance"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1f4123100c13dec3aefa6a06c0f865f95bcb640b3427a362055496b778f8053e",
                "md5": "bbcae00503c6d4f88055ab32226d7213",
                "sha256": "58903476444d08b8df2fe5a250d68f7d286a375d6d5c7ae8f3dc4ecd15bb78f8"
            },
            "downloads": -1,
            "filename": "wavefront_pyformance-1.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bbcae00503c6d4f88055ab32226d7213",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 14250,
            "upload_time": "2023-08-07T21:42:12",
            "upload_time_iso_8601": "2023-08-07T21:42:12.968230Z",
            "url": "https://files.pythonhosted.org/packages/1f/41/23100c13dec3aefa6a06c0f865f95bcb640b3427a362055496b778f8053e/wavefront_pyformance-1.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b6a718430feee551c0e0b68c5969b1764d362c8bb692e9be783793908eaf6944",
                "md5": "392c7758fca68df0af41a1b1d745e700",
                "sha256": "b51c759807072e0fc5fe628e1a121ee7ee473e0141ec9923d91609d3a4495234"
            },
            "downloads": -1,
            "filename": "wavefront-pyformance-1.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "392c7758fca68df0af41a1b1d745e700",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 14535,
            "upload_time": "2023-08-07T21:42:14",
            "upload_time_iso_8601": "2023-08-07T21:42:14.482177Z",
            "url": "https://files.pythonhosted.org/packages/b6/a7/18430feee551c0e0b68c5969b1764d362c8bb692e9be783793908eaf6944/wavefront-pyformance-1.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-07 21:42:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "wavefrontHQ",
    "github_project": "wavefront-pyformance",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "wavefront-pyformance"
}
        
Elapsed time: 0.10588s