NAME
ETL::Yertl::Adapter::graphite - Adapter to read/write from Graphite time series database
VERSION
version 0.044
SYNOPSIS
my $db = ETL::Yertl::Adapter::graphite->new( 'graphite://localhost:8086' );
my @points = $db->read_ts( { metric => 'db.cpu_load.1m' } );
$db->write_ts( { metric => 'db.cpu_load.1m', value => 1.23 } );
DESCRIPTION
This class allows Yertl to read and write time series from the Graphite time series system. Yertl can write to Carbon using the "plaintext" protocol, and read from Graphite using its HTTP API.
This adapter is used by the yts command.
Metric Name Format
Graphite metrics are paths separated by .
, which is the native format that Yertl supports.
yts graphite://localhost foo.bar.baz
yts graphite://localhost foo.bar
METHODS
new
my $db = ETL::Yertl::Adapter::graphite->new( 'graphite://localhost' );
my $db = ETL::Yertl::Adapter::graphite->new( 'graphite://localhost:8080' );
Construct a new Graphite adapter for the database on the given host and port. Port is optional and defaults to 2003
(the Carbon plaintext port) for writing and 8080
(the default Graphite HTTP API port) for reading.
read_ts
my @points = $db->read_ts( $query );
Read a time series from the database. $query
is a hash reference with the following keys:
- metric
-
The time series to read. For Graphite, this is a path separated by dots (
.
). - start
-
An ISO8601 date/time for the start of the series points to return, inclusive.
- end
-
An ISO8601 date/time for the end of the series points to return, inclusive.
-
NOTE: Graphite does not support per-value tags. Using this field will cause a fatal error.
write_ts
$db->write_ts( @points );
Write time series points to the database. @points
is an array of hashrefs with the following keys:
- metric
-
The metric to write. For Graphite, this is a path separated by dots (
.
). - timestamp
-
An ISO8601 timestamp or UNIX epoch time. Optional. Defaults to the current time.
- value
-
The metric value.
-
NOTE: Graphite does not support per-value tags. Using this field will cause a fatal error.
SEE ALSO
ETL::Yertl, yts, Write to Carbon Read from Graphite
AUTHOR
Doug Bell <preaction@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2018 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.