Skip to content

Graphite

Bases: Spout

__init__(output, state, **kwargs)

Initialize the Graphite class.

Parameters:

Name Type Description Default
output BatchOutput

An instance of the BatchOutput class for saving the data.

required
state State

An instance of the State class for maintaining the state.

required
**kwargs

Additional keyword arguments.

{}

Using geniusrise to invoke via command line

genius Graphite rise \
    batch \
        --output_s3_bucket my_bucket \
        --output_s3_folder s3/folder \
    none \
    fetch \
        --args url=http://localhost:8080 target=stats_counts.myapp output_format=json from=-1h until=now

Using geniusrise to invoke via YAML file

version: "1"
spouts:
    my_graphite_spout:
        name: "Graphite"
        method: "fetch"
        args:
            url: "http://localhost:8080"
            target: "stats_counts.myapp"
            output_format: "json"
            from: "-1h"
            until: "now"
        output:
            type: "batch"
            args:
                bucket: "my_bucket"
                s3_folder: "s3/folder"

fetch(url, target, output_format='json', from_time='-1h', until='now')

📖 Fetch data from a Graphite database and save it in batch.

Parameters:

Name Type Description Default
url str

The Graphite API URL.

required
target str

The target metric to fetch.

required
output_format str

The output format. Defaults to "json".

'json'
from_time str

The start time for fetching data. Defaults to "-1h".

'-1h'
until str

The end time for fetching data. Defaults to "now".

'now'

Raises:

Type Description
Exception

If unable to connect to the Graphite server or fetch the data.