riemann.influxdb
Forwards events to InfluxDB. Supports InfluxDB 0.9 or higher.
convert-time
(convert-time time-event precision)
Converts the time-event
parameter (which is time second) in a new time unit specified by the precision
parameter. It also converts the time to long.
The precision
parameter is a keyword whose possible values are :seconds
, :milliseconds
and :microseconds
.
Returns time in seconds by default.
converts-double
(converts-double n)
if n if a ratio or a BigInt, converts it to double. Returns n otherwise.
event->point
(event->point event opts)
Converts a Riemann event into an InfluxDB Point (an instance of org.influxdb.dto.Point
.
The first parameter is the event:
- The
:precision
event key is used to converts the eventtime
into the correct time unit (default seconds). - The
:measurement
event key is the influxdb measurement. - The
:influxdb-tags
event key contains all the Influxdb tags. - The
:influxdb-fields
event key contains all the Influxdb fields.
The second parameter is the option map passed to the influxdb stream.
event->point-9
(event->point-9 event opts)
Converts a Riemann event into an InfluxDB Point (an instance of org.influxdb.dto.Point
.
- The first parameter is the event. The
:precision
key of the event is used to converts the eventtime
into the correct time unit (default seconds). - The second parameter is the option map passed to the InfluxDB stream.
event-fields
(event-fields tag-fields event)
Generates a map of InfluxDB fields from a Riemann event.
The event’s metric
is converted to the value
field, and any additional event fields which are not standard Riemann properties or in tag-fields
will also be present.
event-tags
(event-tags tag-fields event)
Generates a map of InfluxDB tags from a Riemann event.
Any fields in the event which are named in tag-fields
will be converted to a string key/value entry in the tag map.
get-batchpoint
(get-batchpoint {:keys [tags db retention consistency]})
Returns a org.influxdb.dto.BatchPoints
instance.
get-batchpoints
(get-batchpoints opts events)
Create a org.influxdb.dto.BatchPoints
for each element in the events
list. events
is a list where each element is a list of events.
Each element contains events with the same :db
, :retention
and :consistency
keys.
These options are used to create the BatchPoints. opts
are the global influxdb stream options.
get-builder
(get-builder {:keys [timeout insecure]})
Returns a new okhttp3.OkHttpClient$Builder.
get-client
(get-client {:keys [scheme host port username password], :as opts})
Returns an org.influxdb.InfluxDB
instance.
get-hostname-verifier
(get-hostname-verifier)
Get an instance of javax.net.ssl.HostnameVerifier
.
get-ssl-factory
(get-ssl-factory trust-manager)
Get an instance of javax.net.ssl.SSLSocketFactory
.
get-time-unit
(get-time-unit precision)
Returns a value from the TimeUnit enum depending of the precision
parameters.
The precision
parameter is a keyword whose possible values are :seconds
, :milliseconds
and :microseconds
.
Returns TimeUnit/SECONDS
by default.
get-trust-manager
(get-trust-manager)
Returns an instance of X509TrustManager
Used for trust all certs in the InfluxDB insecure
mode.
influxdb
(influxdb opts)
Returns a function which accepts an event, or sequence of events, and writes them to InfluxDB as a batch of measurement points. For performance, you should wrap this stream with batch
or an asynchronous queue.
Support InfluxDB 0.9 to InfluxDB 1.7.
(influxdb {:host "influxdb.example.com"
:db "my_db"
:username "riemann"
:password "secret"})
General Options:
:db
Name of the database to write to. (default:"riemann"
):version
Version of InfluxDB client to use. (default:":deprecated"
):scheme
URL scheme for endpoint. (default:"http"
):host
Hostname to write points to. (default:"localhost"
):port
API port number. (default:8086
):username
Database user to authenticate as. (default:"root"
):password
Password to authenticate with. (optional):tags
A common map of tags to apply to all points. (optional):retention
Name of retention policy to use. (optional):timeout
HTTP timeout in milliseconds. (default:5000
):consistency
The InfluxDB consistency level (default:"ONE"
). Possibles values are ALL, ANY, ONE, QUORUM.:insecure
If scheme is https and certficate is self-signed. (optional):precision
The time precision. Possibles values are:seconds
,:milliseconds
and:microseconds
(default:seconds
). The eventtime
will be converted.
See influxdb-deprecated
and influxdb-new-stream
for version-specific options.
influxdb-deprecated
(influxdb-deprecated opts)
Returns a function which accepts an event, or sequence of events, and writes them to InfluxDB.
InfluxDB-deprecated specifics options:
:tag-fields
A set of event fields to map into InfluxDB series tags. (default:#{:host}
).
Each event can have these keys:
:tag-fields
A set of event fields to map into InfluxDB series tags.:precision
The time precision. Possibles values are:seconds
,:milliseconds
and:microseconds
(default:seconds
). The eventtime
will be converted.
influxdb-new-stream
(influxdb-new-stream opts)
Returns a function which accepts an event, or sequence of events, and writes them to InfluxDB.
Streams receive an event or a list of events. Each event can have these keys:
:measurement
The InfluxDB measurement.:influxdb-tags
A map of InfluxDB tags. Example:{:foo "bar"}
:influxdb-fields
A map of InfluxDB fields. Example:{:bar "baz"}
:precision
The time precision. Possibles values are:seconds
,:milliseconds
and:microseconds
(default:seconds
). The eventtime
will be converted.:db
Name of the database to write to (optional).:retention
Name of retention policy to use (optional).:consistency
The InfluxDB consistency level (default:"ONE"
). Possibles values are ALL, ANY, ONE, QUORUM.
partition-events
(partition-events events)
events
is a list of events.
Partition events
depending of the db
, retention
and consistency
keys returns a list, each element being a list of events (the result of the partitioning).
write-batch-point
(write-batch-point connection batch-point)
Write to InfluxDB the batch-point
using the connection
.