The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojo::InfluxDB - Super simple InfluxDB async cappable client with a nice interface

VERSION

version 0.1

SYNOPSIS

    use Mojo::InfluxDB;

    my $client = Mojo::InfluxDB->new( database => 'telegraf' );

    my $result = $client->query('
        SELECT last(state) AS state
        FROM telegraf.thirty_days.mongodb
        WHERE time > now() - 5h
        GROUP BY time(1h), host
    ');

    $result->first->points;

DESCRIPTION

We needed to do some async queries on our company InfluxDB instance and with some time this module has been growing. As it's useful for Us, it might also be useful for others so here I am releasing it.

This is not yet a full implementation of an InfluxDB driver. I will be very happy to accept contributions and to modify anything about this group of classes, so be warned that this is "beta" quality and the interface will change if it's needed to implement new features or if me or someone else found a nicer way.

ATTRIBUTES

host

Host of your InfluxDB instance: 'localhost' by default.

port

Port of your InfluxDB instance: 8086 by default.

database

The name of the database you want this client to send the queries. You can change it at any time.

time_zone

An optional time_zone to be passed into results which will finally allow InfluxDB::Point to build DateTime objects on your requested time_zone.

METHODS

query

will run queries synchronously. See query_p().

query_p

will run queries asynchronously and return a promise to get a Mojo::Collection of Mojo::InfluxDB::Result objects.

raw_query_p

will run a query and return a Mojo::Transaction::HTTP.

BUGS

As in any piece of software there might be bugs around. If you found one, please report it at the github repo:

https://github.com/gonzalo-radio/mojo-influxdb

Pull requests to fix bugs or add functionality are very welcomed, but please include an explanation of what you want to achieve.

TODO

SEE ALSO

AUTHOR

Gonzalo Radio <gonzalo@gnzl.net>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by Gonzalo Radio.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.