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
:precisionevent key is used to converts the eventtimeinto the correct time unit (default seconds). - The
:measurementevent key is the influxdb measurement. - The
:influxdb-tagsevent key contains all the Influxdb tags. - The
:influxdb-fieldsevent 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
:precisionkey of the event is used to converts the eventtimeinto 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:
:dbName of the database to write to. (default:"riemann"):versionVersion of InfluxDB client to use. (default:":deprecated"):schemeURL scheme for endpoint. (default:"http"):hostHostname to write points to. (default:"localhost"):portAPI port number. (default:8086):usernameDatabase user to authenticate as. (default:"root"):passwordPassword to authenticate with. (optional):tagsA common map of tags to apply to all points. (optional):retentionName of retention policy to use. (optional):timeoutHTTP timeout in milliseconds. (default:5000):consistencyThe InfluxDB consistency level (default:"ONE"). Possibles values are ALL, ANY, ONE, QUORUM.:insecureIf scheme is https and certficate is self-signed. (optional):precisionThe time precision. Possibles values are:seconds,:millisecondsand:microseconds(default:seconds). The eventtimewill 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-fieldsA set of event fields to map into InfluxDB series tags. (default:#{:host}).
Each event can have these keys:
:tag-fieldsA set of event fields to map into InfluxDB series tags.:precisionThe time precision. Possibles values are:seconds,:millisecondsand:microseconds(default:seconds). The eventtimewill 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:
:measurementThe InfluxDB measurement.:influxdb-tagsA map of InfluxDB tags. Example:{:foo "bar"}:influxdb-fieldsA map of InfluxDB fields. Example:{:bar "baz"}:precisionThe time precision. Possibles values are:seconds,:millisecondsand:microseconds(default:seconds). The eventtimewill be converted.:dbName of the database to write to (optional).:retentionName of retention policy to use (optional).:consistencyThe 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.