https://github.com/owainlewis/influx
An async client for Influx DB
https://github.com/owainlewis/influx
async-client http-kit influxdb
Last synced: about 2 months ago
JSON representation
An async client for Influx DB
- Host: GitHub
- URL: https://github.com/owainlewis/influx
- Owner: owainlewis
- License: epl-1.0
- Created: 2016-04-23T19:07:08.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-26T17:04:04.000Z (over 8 years ago)
- Last Synced: 2025-02-01T04:42:10.253Z (4 months ago)
- Topics: async-client, http-kit, influxdb
- Language: Clojure
- Homepage:
- Size: 25.4 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Influx


An async client for Influx DB. If there's anything I've missed please get in touch.
Internally this client uses http-kit for async requests. Use the *@* operator to block requests. See http-kit for more info.InfluxDB has a really simple HTTP API an so this client tries to adhere to that simplicity as much as possible.
## Usage
[](https://clojars.org/io.forward/influx)
## Getting Started
```clojure
(ns my-ns
(:require [influx.core :as influx]))
```All requests require configuration which is just a map of information needed to connect to InfluxDB
```clojure
(def local-conf
{ :host "http://192.168.99.100"
:port 8086
:user nil
:password nil
})
```## Queries
Running simple "raw" queries is straightforward.
```clojure
@(influx/query local-conf "SHOW DATABASES")
```An example REPL session showing the difference between blocking and non blocking requests.
```clojure
(query local-conf show-databases-query)
;; #promise[{:status :pending, :val nil} 0xa50d47c]@(query local-conf show-databases-query)
;; {:status 200,
;; :body {:results [{:series [{:name "databases", :columns ["name"], :values [["_internal"]]}]}]}}
```## Writing Data
If you want to write a single line of data to influx
```clojure
(influx/write-metric local-conf "mydb" "cpu_load_short,host=server02 value=0.67")
```Or a batch of data
```clojure
(def sample-data
[ "cpu_load_short,host=server02 value=0.67"
"cpu_load_short,host=server02,region=us-west value=0.55 1422568543702900257"
"cpu_load_short,direction=in,host=server01,region=us-west value=2.0 1422568543702900257" ])(influx/write-batch-metrics local-conf "mydb" sample-data)
```## License
Copyright © 2016 Owain Lewis
Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.