Skip to main content

A Wishbone encode module to flatten a dict structure of arbitrary depth into individual metric events.

Project description

          __       __    __
.--.--.--|__.-----|  |--|  |--.-----.-----.-----.
|  |  |  |  |__ --|     |  _  |  _  |     |  -__|
|________|__|_____|__|__|_____|_____|__|__|_____|
                                   version 2.1.2

Build composable event pipeline servers with minimal effort.



=======================
wishbone.encode.flatten
=======================

Version: 1.0.0

Flattens a dict structure of arbitrary depth into individual metric events.
---------------------------------------------------------------------------


    This module takes a <dict> structure and recursively travels it
    flattening the namespace into a dotted format untill a numeric value
    is encountered. For each metric a <wishbone.event.Metric>
    datastructure is created and stored in the @data part of
    <wishbone.event.Event>.

    Non-numeric values are ignored.

    For example:

        {"server": {"host01": {"memory": {"free": 10, "consumed": 90}}}}

        Would generate following metrics:

        server.host01.memory.free
        server.host01.memory.consumed

    These metrics are converted to the Wishbone metric data format:

        http://wishbone.readthedocs.org/en/latest/logs%20and%20metrics.html#format

    The module is expecting a Python <dict> type.  That means you should have
    already decoded the incoming data using a module like wishbone.decode.json.


    Parameters:

        - source(str)("@data")
           |  The event field containing the data to convert.

        - type(str)("wishbone")
           |  An arbitrary string to assign to the "type" field of the Metric
           |  datastructure.

        - metric_source(str)("wishbone")
           |  An arbitrary string to assign to the "source" field of the Metric
           |  datastructure.

        - tags(set)()
           |  An arbitrary set of tags assign to the "tags" field of the Metric
           |  datastructure.


    Queues:

        - inbox:    Incoming events.

        - outbox:   Outgoing events with @data containing the wishbone.event.Metric data.

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

wishbone_encode_flatten-1.0.0.tar.gz (3.4 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page