Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/place-labs/flux
InfluxDB v2.x crystal-lang client / Flux query language tools
https://github.com/place-labs/flux
client crystal-lang influxdb
Last synced: about 2 months ago
JSON representation
InfluxDB v2.x crystal-lang client / Flux query language tools
- Host: GitHub
- URL: https://github.com/place-labs/flux
- Owner: place-labs
- License: mit
- Created: 2019-12-11T07:17:45.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-09-28T22:56:30.000Z (over 3 years ago)
- Last Synced: 2023-03-06T02:33:12.310Z (almost 2 years ago)
- Topics: client, crystal-lang, influxdb
- Language: Crystal
- Homepage:
- Size: 134 KB
- Stars: 6
- Watchers: 9
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flux
Client library for pushing data to, and querying information from InfluxDB v2.x.
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
flux:
github: place-labs/flux
```2. Run `shards install`
## Usage
```crystal
require "flux"
```### Configure the client
Define your client configuration with `Flux.configure`. This yields an
[`Options`](https://github.com/place-labs/flux/blob/master/src/flux.cr#L7-L15) object
with appriopriate setters.```crystal
Flux.configure do |settings|
settings.uri = ENV["INFLUX_HOST"]? || abort "INFLUX_HOST env var not set"
settings.api_key = ENV["INFLUX_API_KEY"]? || abort "INFLUX_API_KEY env var not set"
settings.org = ENV["INFLUX_ORG"]? || "vandelay-industries"
settings.bucket = ENV["INFLUX_BUCKET"]? || "latex-sales"
end
```**NOTE**: `INFLUX_HOST` is expected to be a well-formed URI.
### Writing data
Use `Flux.write` to enqueue a point. Writes are automatically buffered and
flushed after either a time delay or optimal write size.### Running queries
Once information is available in the bucket, queries are executed with
`Flux.query`. This accepts a [Flux
expression](https://v2.docs.influxdata.com/v2.0/reference/flux/).### Parallel clients
If your application requires connectivity with more that one InfluxDB instance
or bucket, clients can be directly created with `Flux::Client.new`.## Contributing
1. Fork it ()
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request## Contributors
- [Kim Burgess](https://github.com/kimburgess) - creator and maintainer