lex-influxdb 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +16 -0
- data/.rubocop.yml +37 -14
- data/CHANGELOG.md +22 -0
- data/CLAUDE.md +75 -0
- data/Gemfile +5 -1
- data/Gemfile.lock +142 -3
- data/README.md +24 -25
- data/legion-extensions-influxdb.gemspec +5 -5
- data/lib/legion/extensions/influxdb/client.rb +29 -0
- data/lib/legion/extensions/influxdb/helpers/client.rb +11 -11
- data/lib/legion/extensions/influxdb/runners/cluster.rb +12 -6
- data/lib/legion/extensions/influxdb/runners/continuous_query.rb +17 -11
- data/lib/legion/extensions/influxdb/runners/database.rb +30 -24
- data/lib/legion/extensions/influxdb/runners/measurement.rb +11 -5
- data/lib/legion/extensions/influxdb/runners/retention_policy.rb +19 -13
- data/lib/legion/extensions/influxdb/runners/series.rb +9 -3
- data/lib/legion/extensions/influxdb/runners/user.rb +15 -9
- data/lib/legion/extensions/influxdb/runners/writer.rb +34 -11
- data/lib/legion/extensions/influxdb/version.rb +3 -1
- data/lib/legion/extensions/influxdb.rb +13 -2
- metadata +14 -13
- data/.idea/lex-influxdb.iml +0 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a6317e42ec248c5831ca02c14bb6605b04fc16c071e0cbd22be82c77321a65c3
|
|
4
|
+
data.tar.gz: '09ba693382aa32d408aaed540f76261ede601e50eb9427ef5c92d91a71e42db6'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f174f9131ae3d8a9fc9f81dc091b70c71573e16872aee1e13a4358eb798447f48533e8641c83ec7262c9780f6a5ad54e5868abdad1cf07ebb400c0c467434ae
|
|
7
|
+
data.tar.gz: 40bd7f522f38ec746a76712e741bd26608775e61330324feddf2fac1d80f7c58cf4cb95b583184e1a42c899bba31900ee8a0e8f0a8f8e055c5345f18921e36f9
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
ci:
|
|
9
|
+
uses: LegionIO/.github/.github/workflows/ci.yml@main
|
|
10
|
+
|
|
11
|
+
release:
|
|
12
|
+
needs: ci
|
|
13
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
14
|
+
uses: LegionIO/.github/.github/workflows/release.yml@main
|
|
15
|
+
secrets:
|
|
16
|
+
rubygems-api-key: ${{ secrets.RUBYGEMS_API_KEY }}
|
data/.rubocop.yml
CHANGED
|
@@ -1,25 +1,48 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 3.4
|
|
3
|
+
NewCops: enable
|
|
4
|
+
SuggestExtensions: false
|
|
5
|
+
|
|
1
6
|
Layout/LineLength:
|
|
2
|
-
Max:
|
|
3
|
-
|
|
4
|
-
Max: 30
|
|
5
|
-
Metrics/ClassLength:
|
|
6
|
-
Max: 1500
|
|
7
|
-
Metrics/BlockLength:
|
|
8
|
-
Max: 50
|
|
7
|
+
Max: 160
|
|
8
|
+
|
|
9
9
|
Layout/SpaceAroundEqualsInParameterDefault:
|
|
10
10
|
EnforcedStyle: space
|
|
11
|
-
|
|
12
|
-
Enabled: true
|
|
11
|
+
|
|
13
12
|
Layout/HashAlignment:
|
|
14
13
|
EnforcedHashRocketStyle: table
|
|
15
14
|
EnforcedColonStyle: table
|
|
15
|
+
|
|
16
|
+
Metrics/MethodLength:
|
|
17
|
+
Max: 50
|
|
18
|
+
|
|
19
|
+
Metrics/ClassLength:
|
|
20
|
+
Max: 1500
|
|
21
|
+
|
|
22
|
+
Metrics/ModuleLength:
|
|
23
|
+
Max: 1500
|
|
24
|
+
|
|
25
|
+
Metrics/BlockLength:
|
|
26
|
+
Max: 40
|
|
27
|
+
|
|
28
|
+
Metrics/AbcSize:
|
|
29
|
+
Max: 60
|
|
30
|
+
|
|
31
|
+
Metrics/CyclomaticComplexity:
|
|
32
|
+
Max: 15
|
|
33
|
+
|
|
34
|
+
Metrics/PerceivedComplexity:
|
|
35
|
+
Max: 17
|
|
36
|
+
|
|
16
37
|
Style/Documentation:
|
|
17
38
|
Enabled: false
|
|
18
|
-
|
|
19
|
-
|
|
39
|
+
|
|
40
|
+
Style/SymbolArray:
|
|
41
|
+
Enabled: true
|
|
42
|
+
|
|
20
43
|
Style/FrozenStringLiteralComment:
|
|
21
|
-
Enabled:
|
|
44
|
+
Enabled: true
|
|
45
|
+
EnforcedStyle: always
|
|
46
|
+
|
|
22
47
|
Naming/FileName:
|
|
23
48
|
Enabled: false
|
|
24
|
-
Style/ClassAndModuleChildren:
|
|
25
|
-
Enabled: false
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.2.0] - 2026-03-15
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Standalone `Client` class that includes all runners and delegates to `Helpers::Client`
|
|
7
|
+
- Specs for `Helpers::Client` and `Client` class
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- `Helpers::Client#client` is now configurable via `host:`, `port:`, and `database:` kwargs
|
|
11
|
+
- `Runners::Writer` now uses `Helpers::Client.client` instead of constructing `InfluxDB::Client` inline
|
|
12
|
+
- `write` runner now accepts `series:` and `data:` and actually writes the data point
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Removed hardcoded `esphome` database name from `Helpers::Client`
|
|
16
|
+
- Removed hardcoded `influx.home.whonodes.org` hostname from `Helpers::Client`
|
|
17
|
+
- Fixed `InfluxBD` typo (was never a valid constant reference)
|
|
18
|
+
|
|
19
|
+
## [0.1.2] - 2026-03-13
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
- Initial release
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# lex-influxdb: InfluxDB Integration for LegionIO
|
|
2
|
+
|
|
3
|
+
**Repository Level 3 Documentation**
|
|
4
|
+
- **Parent**: `/Users/miverso2/rubymine/legion/extensions-other/CLAUDE.md`
|
|
5
|
+
- **Grandparent**: `/Users/miverso2/rubymine/legion/CLAUDE.md`
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Legion Extension that connects LegionIO to InfluxDB time-series databases. Provides runners for writing data, managing databases, users, retention policies, continuous queries, measurements, series, and cluster info.
|
|
10
|
+
|
|
11
|
+
**GitHub**: https://github.com/LegionIO/lex-influxdb
|
|
12
|
+
**License**: MIT
|
|
13
|
+
|
|
14
|
+
## Architecture
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
Legion::Extensions::Influxdb
|
|
18
|
+
├── Client # Standalone client class (includes all runners)
|
|
19
|
+
├── Runners/
|
|
20
|
+
│ ├── Writer # Write data points
|
|
21
|
+
│ ├── Database # Database CRUD
|
|
22
|
+
│ ├── User # User management
|
|
23
|
+
│ ├── RetentionPolicy # Retention policy management
|
|
24
|
+
│ ├── ContinuousQuery # Continuous query management
|
|
25
|
+
│ ├── Measurement # Measurement queries
|
|
26
|
+
│ ├── Series # Series queries
|
|
27
|
+
│ └── Cluster # Cluster info
|
|
28
|
+
└── Helpers/
|
|
29
|
+
└── Client # InfluxDB client factory (host: localhost, port: 8086)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Standalone Usage
|
|
33
|
+
|
|
34
|
+
`Legion::Extensions::Influxdb::Client` provides direct access to all runners without the Legion runtime:
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
client = Legion::Extensions::Influxdb::Client.new(host: 'influx.example.com', database: 'mydb')
|
|
38
|
+
client.write_data(...)
|
|
39
|
+
client.list_databases
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Constructor accepts `host:` (default `'localhost'`), `port:` (default `8086`), `database:` (default `nil`), and any extra kwargs passed through to `InfluxDB::Client`.
|
|
43
|
+
|
|
44
|
+
## Key Files
|
|
45
|
+
|
|
46
|
+
| Path | Purpose |
|
|
47
|
+
|------|---------|
|
|
48
|
+
| `lib/legion/extensions/influxdb.rb` | Entry point, extension registration |
|
|
49
|
+
| `lib/legion/extensions/influxdb/client.rb` | Standalone client class, includes all runners |
|
|
50
|
+
| `lib/legion/extensions/influxdb/helpers/client.rb` | InfluxDB client factory (`module_function`; configurable host/port/database) |
|
|
51
|
+
| `lib/legion/extensions/influxdb/runners/` | All runners |
|
|
52
|
+
|
|
53
|
+
## Dependencies
|
|
54
|
+
|
|
55
|
+
| Gem | Purpose |
|
|
56
|
+
|-----|---------|
|
|
57
|
+
| `influxdb` | InfluxDB Ruby client |
|
|
58
|
+
|
|
59
|
+
## Version
|
|
60
|
+
|
|
61
|
+
Current version: **0.2.0**
|
|
62
|
+
|
|
63
|
+
- v0.2.0: Fixed hardcoded hostname (`influx.home.whonodes.org`) and database name (`esphome`) in `Helpers::Client`. Both are now configurable kwargs with safe defaults (`host: 'localhost'`, `database: nil`). Standalone `Client` class added.
|
|
64
|
+
|
|
65
|
+
## Development
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
bundle install
|
|
69
|
+
bundle exec rspec
|
|
70
|
+
bundle exec rubocop
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
**Maintained By**: Matthew Iverson (@Esity)
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,19 +1,158 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
lex-influxdb (0.
|
|
4
|
+
lex-influxdb (0.2.0)
|
|
5
5
|
influxdb
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
|
|
10
|
+
addressable (2.8.9)
|
|
11
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
12
|
+
amq-protocol (2.5.1)
|
|
13
|
+
ast (2.4.3)
|
|
14
|
+
aws-eventstream (1.4.0)
|
|
15
|
+
aws-sigv4 (1.12.1)
|
|
16
|
+
aws-eventstream (~> 1, >= 1.0.2)
|
|
17
|
+
base64 (0.3.0)
|
|
18
|
+
bigdecimal (4.0.1)
|
|
19
|
+
bunny (2.24.0)
|
|
20
|
+
amq-protocol (~> 2.3)
|
|
21
|
+
sorted_set (~> 1, >= 1.0.2)
|
|
22
|
+
concurrent-ruby (1.3.6)
|
|
23
|
+
concurrent-ruby-ext (1.3.6)
|
|
24
|
+
concurrent-ruby (= 1.3.6)
|
|
25
|
+
connection_pool (2.5.5)
|
|
26
|
+
daemons (1.4.1)
|
|
27
|
+
dalli (5.0.2)
|
|
28
|
+
logger
|
|
29
|
+
diff-lcs (1.6.2)
|
|
30
|
+
docile (1.4.1)
|
|
31
|
+
influxdb (0.8.1)
|
|
32
|
+
json (2.19.1)
|
|
33
|
+
json-schema (6.2.0)
|
|
34
|
+
addressable (~> 2.8)
|
|
35
|
+
bigdecimal (>= 3.1, < 5)
|
|
36
|
+
json_pure (2.8.1)
|
|
37
|
+
language_server-protocol (3.17.0.5)
|
|
38
|
+
legion-cache (1.2.0)
|
|
39
|
+
connection_pool (>= 2.2.3)
|
|
40
|
+
dalli (>= 2.7)
|
|
41
|
+
legion-logging
|
|
42
|
+
legion-settings
|
|
43
|
+
redis (>= 4.2)
|
|
44
|
+
legion-crypt (1.2.0)
|
|
45
|
+
vault (>= 0.15.0)
|
|
46
|
+
legion-json (1.2.0)
|
|
47
|
+
json_pure
|
|
48
|
+
multi_json
|
|
49
|
+
legion-logging (1.2.0)
|
|
50
|
+
rainbow (~> 3)
|
|
51
|
+
legion-settings (1.2.0)
|
|
52
|
+
legion-json (>= 1.2)
|
|
53
|
+
legion-transport (1.2.0)
|
|
54
|
+
bunny (>= 2.17.0)
|
|
55
|
+
concurrent-ruby (>= 1.1.7)
|
|
56
|
+
legion-json
|
|
57
|
+
legion-settings
|
|
58
|
+
legionio (1.2.1)
|
|
59
|
+
concurrent-ruby (>= 1.1.7)
|
|
60
|
+
concurrent-ruby-ext (>= 1.1.7)
|
|
61
|
+
daemons (>= 1.3.1)
|
|
62
|
+
legion-cache (>= 0.2.0)
|
|
63
|
+
legion-crypt (>= 0.2.0)
|
|
64
|
+
legion-json (>= 0.2.0)
|
|
65
|
+
legion-logging (>= 0.2.0)
|
|
66
|
+
legion-settings (>= 0.2.0)
|
|
67
|
+
legion-transport (>= 1.1.9)
|
|
68
|
+
lex-node
|
|
69
|
+
oj (>= 3.10)
|
|
70
|
+
thor (>= 1)
|
|
71
|
+
lex-node (0.2.0)
|
|
72
|
+
lint_roller (1.1.0)
|
|
73
|
+
logger (1.7.0)
|
|
74
|
+
mcp (0.8.0)
|
|
75
|
+
json-schema (>= 4.1)
|
|
76
|
+
multi_json (1.19.1)
|
|
77
|
+
net-http-persistent (4.0.8)
|
|
78
|
+
connection_pool (>= 2.2.4, < 4)
|
|
79
|
+
oj (3.16.16)
|
|
80
|
+
bigdecimal (>= 3.0)
|
|
81
|
+
ostruct (>= 0.2)
|
|
82
|
+
ostruct (0.6.3)
|
|
83
|
+
parallel (1.27.0)
|
|
84
|
+
parser (3.3.10.2)
|
|
85
|
+
ast (~> 2.4.1)
|
|
86
|
+
racc
|
|
87
|
+
prism (1.9.0)
|
|
88
|
+
public_suffix (7.0.5)
|
|
89
|
+
racc (1.8.1)
|
|
90
|
+
rainbow (3.1.1)
|
|
91
|
+
rake (12.3.3)
|
|
92
|
+
rbtree (0.4.6)
|
|
93
|
+
redis (5.4.1)
|
|
94
|
+
redis-client (>= 0.22.0)
|
|
95
|
+
redis-client (0.27.0)
|
|
96
|
+
connection_pool
|
|
97
|
+
regexp_parser (2.11.3)
|
|
98
|
+
rspec (3.13.2)
|
|
99
|
+
rspec-core (~> 3.13.0)
|
|
100
|
+
rspec-expectations (~> 3.13.0)
|
|
101
|
+
rspec-mocks (~> 3.13.0)
|
|
102
|
+
rspec-core (3.13.6)
|
|
103
|
+
rspec-support (~> 3.13.0)
|
|
104
|
+
rspec-expectations (3.13.5)
|
|
105
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
106
|
+
rspec-support (~> 3.13.0)
|
|
107
|
+
rspec-mocks (3.13.8)
|
|
108
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
109
|
+
rspec-support (~> 3.13.0)
|
|
110
|
+
rspec-support (3.13.7)
|
|
111
|
+
rubocop (1.85.1)
|
|
112
|
+
json (~> 2.3)
|
|
113
|
+
language_server-protocol (~> 3.17.0.2)
|
|
114
|
+
lint_roller (~> 1.1.0)
|
|
115
|
+
mcp (~> 0.6)
|
|
116
|
+
parallel (~> 1.10)
|
|
117
|
+
parser (>= 3.3.0.2)
|
|
118
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
119
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
120
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
121
|
+
ruby-progressbar (~> 1.7)
|
|
122
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
123
|
+
rubocop-ast (1.49.1)
|
|
124
|
+
parser (>= 3.3.7.2)
|
|
125
|
+
prism (~> 1.7)
|
|
126
|
+
ruby-progressbar (1.13.0)
|
|
127
|
+
simplecov (0.22.0)
|
|
128
|
+
docile (~> 1.1)
|
|
129
|
+
simplecov-html (~> 0.11)
|
|
130
|
+
simplecov_json_formatter (~> 0.1)
|
|
131
|
+
simplecov-html (0.13.2)
|
|
132
|
+
simplecov_json_formatter (0.1.4)
|
|
133
|
+
sorted_set (1.1.0)
|
|
134
|
+
rbtree
|
|
135
|
+
thor (1.5.0)
|
|
136
|
+
unicode-display_width (3.2.0)
|
|
137
|
+
unicode-emoji (~> 4.1)
|
|
138
|
+
unicode-emoji (4.2.0)
|
|
139
|
+
vault (0.20.0)
|
|
140
|
+
aws-sigv4
|
|
141
|
+
base64
|
|
142
|
+
connection_pool (~> 2.4)
|
|
143
|
+
net-http-persistent (~> 4.0, >= 4.0.2)
|
|
11
144
|
|
|
12
145
|
PLATFORMS
|
|
146
|
+
arm64-darwin-25
|
|
13
147
|
ruby
|
|
14
148
|
|
|
15
149
|
DEPENDENCIES
|
|
150
|
+
legionio
|
|
16
151
|
lex-influxdb!
|
|
152
|
+
rake (~> 12.0)
|
|
153
|
+
rspec (~> 3.0)
|
|
154
|
+
rubocop
|
|
155
|
+
simplecov
|
|
17
156
|
|
|
18
157
|
BUNDLED WITH
|
|
19
|
-
2.
|
|
158
|
+
2.6.9
|
data/README.md
CHANGED
|
@@ -1,39 +1,38 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/legion/extensions/influxdb`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
1
|
+
# lex-influxdb
|
|
4
2
|
|
|
3
|
+
InfluxDB integration for [LegionIO](https://github.com/LegionIO/LegionIO). Read, write, and manage InfluxDB time-series databases.
|
|
5
4
|
|
|
6
5
|
## Installation
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
```ruby
|
|
11
|
-
gem 'legion-extensions-influxdb'
|
|
7
|
+
```bash
|
|
8
|
+
gem install lex-influxdb
|
|
12
9
|
```
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
$ bundle install
|
|
17
|
-
|
|
18
|
-
Or install it yourself as:
|
|
19
|
-
|
|
20
|
-
$ gem install legion-extensions-influxdb
|
|
11
|
+
Or add to your Gemfile:
|
|
21
12
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
## Development
|
|
27
|
-
|
|
28
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
13
|
+
```ruby
|
|
14
|
+
gem 'lex-influxdb'
|
|
15
|
+
```
|
|
29
16
|
|
|
30
|
-
|
|
17
|
+
## Runners
|
|
31
18
|
|
|
32
|
-
|
|
19
|
+
| Runner | Operations |
|
|
20
|
+
|--------|-----------|
|
|
21
|
+
| Writer | Write data points |
|
|
22
|
+
| Database | Database CRUD |
|
|
23
|
+
| User | User management |
|
|
24
|
+
| RetentionPolicy | Retention policy management |
|
|
25
|
+
| ContinuousQuery | Continuous query management |
|
|
26
|
+
| Measurement | Measurement queries |
|
|
27
|
+
| Series | Series queries |
|
|
28
|
+
| Cluster | Cluster info |
|
|
33
29
|
|
|
34
|
-
|
|
30
|
+
## Requirements
|
|
35
31
|
|
|
32
|
+
- Ruby >= 3.4
|
|
33
|
+
- [LegionIO](https://github.com/LegionIO/LegionIO) framework
|
|
34
|
+
- InfluxDB server (default: localhost:8086)
|
|
36
35
|
|
|
37
36
|
## License
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
MIT
|
|
@@ -10,20 +10,20 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
|
|
11
11
|
spec.summary = 'LEX::Influxdb'
|
|
12
12
|
spec.description = 'Used to connect Legion to influxdb'
|
|
13
|
-
spec.homepage = 'https://
|
|
13
|
+
spec.homepage = 'https://github.com/LegionIO/lex-influxdb'
|
|
14
14
|
spec.license = 'MIT'
|
|
15
|
-
spec.required_ruby_version =
|
|
15
|
+
spec.required_ruby_version = '>= 3.4'
|
|
16
16
|
|
|
17
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
|
18
|
-
spec.metadata['source_code_uri'] = 'https://
|
|
19
|
-
spec.metadata['changelog_uri'] = 'https://
|
|
18
|
+
spec.metadata['source_code_uri'] = 'https://github.com/LegionIO/lex-influxdb'
|
|
19
|
+
spec.metadata['changelog_uri'] = 'https://github.com/LegionIO/lex-influxdb/blob/main/CHANGELOG.md'
|
|
20
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
20
21
|
|
|
21
22
|
# Specify which files should be added to the gem when it is released.
|
|
22
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
23
24
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
24
25
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
25
26
|
end
|
|
26
|
-
spec.bindir = 'exe'
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
28
28
|
spec.require_paths = ['lib']
|
|
29
29
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Influxdb
|
|
6
|
+
class Client
|
|
7
|
+
include Helpers::Client
|
|
8
|
+
include Runners::Writer
|
|
9
|
+
include Runners::Database
|
|
10
|
+
include Runners::User
|
|
11
|
+
include Runners::RetentionPolicy
|
|
12
|
+
include Runners::ContinuousQuery
|
|
13
|
+
include Runners::Measurement
|
|
14
|
+
include Runners::Series
|
|
15
|
+
include Runners::Cluster
|
|
16
|
+
|
|
17
|
+
attr_reader :opts
|
|
18
|
+
|
|
19
|
+
def initialize(host: 'localhost', port: 8086, database: nil, **extra)
|
|
20
|
+
@opts = { host: host, port: port, database: database, **extra }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def client(**override)
|
|
24
|
+
Helpers::Client.client(**@opts, **override)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
module Helpers
|
|
3
|
-
module Client
|
|
4
|
-
def client(**_opts)
|
|
5
|
-
@client ||= InfluxBD::Client.new
|
|
6
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Influxdb
|
|
6
|
+
module Helpers
|
|
7
|
+
module Client
|
|
8
|
+
module_function
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
def client(host: 'localhost', port: 8086, database: nil, **)
|
|
11
|
+
InfluxDB::Client.new(database, host: host, port: port, async: false, **)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
end
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
module Runners
|
|
3
|
-
module Cluster
|
|
4
|
-
def self.create(payload); end
|
|
1
|
+
# frozen_string_literal: true
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Influxdb
|
|
6
|
+
module Runners
|
|
7
|
+
module Cluster
|
|
8
|
+
def self.create(payload); end
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
def self.list(payload = {}); end
|
|
11
|
+
|
|
12
|
+
def self.revoke(payload); end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
9
15
|
end
|
|
10
16
|
end
|
|
11
17
|
end
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
module Runners
|
|
3
|
-
module ContinuousQuery
|
|
4
|
-
def self.list(host: 'localhost', port: 8086, **_payload)
|
|
5
|
-
client = InfluxDB::Client.new(host: host, port: port)
|
|
6
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Influxdb
|
|
6
|
+
module Runners
|
|
7
|
+
module ContinuousQuery
|
|
8
|
+
def self.list(host: 'localhost', port: 8086, **_payload)
|
|
9
|
+
InfluxDB::Client.new(host: host, port: port)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.create(_name:, host: 'localhost', port: 8086, **_payload)
|
|
13
|
+
InfluxDB::Client.new(host: host, port: port)
|
|
14
|
+
end
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
def self.delete(_name:, host: 'localhost', port: 8086, **_payload)
|
|
17
|
+
InfluxDB::Client.new(host: host, port: port)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
14
20
|
end
|
|
15
21
|
end
|
|
16
22
|
end
|
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
module Runners
|
|
3
|
-
module Database
|
|
4
|
-
def self.create(name:, host: 'localhost', port: 8086, **payload)
|
|
5
|
-
# client = InfluxDB::Client.new(host: host, port: port)
|
|
6
|
-
require 'influxdb'
|
|
7
|
-
client = InfluxDB::Client.new
|
|
8
|
-
Legion::Logging.unknown({ name: name, host: host, port: port, **payload })
|
|
9
|
-
Legion::Logging.fatal client.create_database(name)
|
|
10
|
-
{ name: name, host: host, port: port, **payload }
|
|
11
|
-
rescue StandardError => e
|
|
12
|
-
Legion::Logging.error e.message
|
|
13
|
-
Legion::Logging.error e.backtrace
|
|
14
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
15
2
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Influxdb
|
|
6
|
+
module Runners
|
|
7
|
+
module Database
|
|
8
|
+
def self.create(name:, host: 'localhost', port: 8086, **payload)
|
|
9
|
+
# client = InfluxDB::Client.new(host: host, port: port)
|
|
10
|
+
require 'influxdb'
|
|
11
|
+
client = InfluxDB::Client.new
|
|
12
|
+
Legion::Logging.unknown({ name: name, host: host, port: port, **payload })
|
|
13
|
+
Legion::Logging.fatal client.create_database(name)
|
|
14
|
+
{ name: name, host: host, port: port, **payload }
|
|
15
|
+
rescue StandardError => e
|
|
16
|
+
Legion::Logging.error e.message
|
|
17
|
+
Legion::Logging.error e.backtrace
|
|
18
|
+
end
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
def self.delete(_name:, _host: 'localhost', _port: 8086, **payload)
|
|
21
|
+
client = InfluxDB::Client.new(host: payload[:host])
|
|
22
|
+
client.delete_database(payload[:name])
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.list(_host: 'localhost', _port: 8086, **payload)
|
|
26
|
+
InfluxDB::Client.new(host: payload[:host]).list_databases
|
|
27
|
+
end
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
def self.field_keys(database: 'telegraf', _host: 'localhost', port: 8086, **payload)
|
|
30
|
+
client = InfluxDB::Client.new(host: payload[:host], port: port, database: database)
|
|
31
|
+
{ results: client.show_field_keys, count: client.show_field_keys.count }
|
|
32
|
+
end
|
|
33
|
+
end
|
|
28
34
|
end
|
|
29
35
|
end
|
|
30
36
|
end
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
module Runners
|
|
3
|
-
module Measurement
|
|
4
|
-
def self.list(payload); end
|
|
1
|
+
# frozen_string_literal: true
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Influxdb
|
|
6
|
+
module Runners
|
|
7
|
+
module Measurement
|
|
8
|
+
def self.list(payload); end
|
|
9
|
+
|
|
10
|
+
def self.delete(payload); end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
7
13
|
end
|
|
8
14
|
end
|
|
9
15
|
end
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
module Runners
|
|
3
|
-
module RetentionPolicy
|
|
4
|
-
include Legion::Extensions::Helpers::Lex
|
|
5
|
-
extend Legion::Extensions::Influxdb::Helpers::Client
|
|
1
|
+
# frozen_string_literal: true
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Influxdb
|
|
6
|
+
module Runners
|
|
7
|
+
module RetentionPolicy
|
|
8
|
+
include Legion::Extensions::Helpers::Lex
|
|
9
|
+
extend Legion::Extensions::Influxdb::Helpers::Client
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
def create(database:, _host: 'localhost', _port: 8086, **payload)
|
|
12
|
+
InfluxDB::Client.new(host: payload[:host]).list_retention_policies(database)
|
|
13
|
+
end
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
def list(database:, _host: 'localhost', _port: 8086, **payload)
|
|
16
|
+
InfluxDB::Client.new(host: payload[:host]).list_retention_policies(database)
|
|
17
|
+
end
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
def self.delete(payload); end
|
|
20
|
+
|
|
21
|
+
def self.alter(payload); end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
18
24
|
end
|
|
19
25
|
end
|
|
20
26
|
end
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
module Runners
|
|
3
|
-
module User
|
|
4
|
-
def self.create(payload); end
|
|
1
|
+
# frozen_string_literal: true
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Influxdb
|
|
6
|
+
module Runners
|
|
7
|
+
module User
|
|
8
|
+
def self.create(payload); end
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
def self.update_password(payload); end
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
def self.grant_user_admin_privileges(payload); end
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
def self.grant_user_privileges(payload); end
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
def self.delete(payload); end
|
|
17
|
+
|
|
18
|
+
def self.list(payload); end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
15
21
|
end
|
|
16
22
|
end
|
|
17
23
|
end
|
|
@@ -1,16 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Influxdb
|
|
6
|
+
module Runners
|
|
7
|
+
module Writer
|
|
8
|
+
def self.write(series:, data:, database:, **opts)
|
|
9
|
+
host = opts.fetch(:host, 'localhost')
|
|
10
|
+
port = opts.fetch(:port, 8086)
|
|
11
|
+
time_precision = opts.fetch(:time_precision, 's')
|
|
12
|
+
extra = opts.except(:host, :port, :time_precision)
|
|
13
|
+
c = Helpers::Client.client(host: host, port: port, database: database, **extra)
|
|
14
|
+
c.write_point(series, data, time_precision)
|
|
15
|
+
{}
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.write_points(metrics:, **opts)
|
|
19
|
+
database = opts.fetch(:database, 'telegraf')
|
|
20
|
+
host = opts.fetch(:host, 'localhost')
|
|
21
|
+
port = opts.fetch(:port, 8086)
|
|
22
|
+
time_precision = opts.fetch(:time_precision, 'ms')
|
|
23
|
+
extra = opts.except(:database, :host, :port, :time_precision)
|
|
24
|
+
metrics = Legion::JSON.load(metrics) if metrics.is_a?(String)
|
|
25
|
+
if metrics[:timestamp].nil?
|
|
26
|
+
metrics[:timestamp] = Time.now.to_i
|
|
27
|
+
time_precision = 's'
|
|
28
|
+
end
|
|
8
29
|
|
|
9
|
-
|
|
10
|
-
|
|
30
|
+
c = Helpers::Client.client(host: host, port: port, database: database, **extra)
|
|
31
|
+
c.write_point('sensors', metrics, time_precision)
|
|
32
|
+
{}
|
|
33
|
+
end
|
|
11
34
|
|
|
12
|
-
|
|
13
|
-
|
|
35
|
+
include Legion::Extensions::Helpers::Lex
|
|
36
|
+
end
|
|
14
37
|
end
|
|
15
38
|
end
|
|
16
39
|
end
|
|
@@ -1,11 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'legion/extensions/influxdb/version'
|
|
2
|
-
require 'legion/extensions'
|
|
3
4
|
require 'influxdb'
|
|
5
|
+
require 'legion/extensions/influxdb/helpers/client'
|
|
6
|
+
require 'legion/extensions/influxdb/runners/writer'
|
|
7
|
+
require 'legion/extensions/influxdb/runners/database'
|
|
8
|
+
require 'legion/extensions/influxdb/runners/user'
|
|
9
|
+
require 'legion/extensions/influxdb/runners/retention_policy'
|
|
10
|
+
require 'legion/extensions/influxdb/runners/continuous_query'
|
|
11
|
+
require 'legion/extensions/influxdb/runners/measurement'
|
|
12
|
+
require 'legion/extensions/influxdb/runners/series'
|
|
13
|
+
require 'legion/extensions/influxdb/runners/cluster'
|
|
14
|
+
require 'legion/extensions/influxdb/client'
|
|
4
15
|
|
|
5
16
|
module Legion
|
|
6
17
|
module Extensions
|
|
7
18
|
module Influxdb
|
|
8
|
-
extend Legion::Extensions::Core
|
|
19
|
+
extend Legion::Extensions::Core if Legion::Extensions.const_defined?(:Core)
|
|
9
20
|
end
|
|
10
21
|
end
|
|
11
22
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lex-influxdb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
8
|
-
|
|
9
|
-
bindir: exe
|
|
8
|
+
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: influxdb
|
|
@@ -32,10 +31,12 @@ extensions: []
|
|
|
32
31
|
extra_rdoc_files: []
|
|
33
32
|
files:
|
|
34
33
|
- ".circleci/config.yml"
|
|
34
|
+
- ".github/workflows/ci.yml"
|
|
35
35
|
- ".gitignore"
|
|
36
|
-
- ".idea/lex-influxdb.iml"
|
|
37
36
|
- ".rspec"
|
|
38
37
|
- ".rubocop.yml"
|
|
38
|
+
- CHANGELOG.md
|
|
39
|
+
- CLAUDE.md
|
|
39
40
|
- Gemfile
|
|
40
41
|
- Gemfile.lock
|
|
41
42
|
- LICENSE.txt
|
|
@@ -45,6 +46,7 @@ files:
|
|
|
45
46
|
- bin/setup
|
|
46
47
|
- legion-extensions-influxdb.gemspec
|
|
47
48
|
- lib/legion/extensions/influxdb.rb
|
|
49
|
+
- lib/legion/extensions/influxdb/client.rb
|
|
48
50
|
- lib/legion/extensions/influxdb/helpers/client.rb
|
|
49
51
|
- lib/legion/extensions/influxdb/runners/cluster.rb
|
|
50
52
|
- lib/legion/extensions/influxdb/runners/continuous_query.rb
|
|
@@ -55,14 +57,14 @@ files:
|
|
|
55
57
|
- lib/legion/extensions/influxdb/runners/user.rb
|
|
56
58
|
- lib/legion/extensions/influxdb/runners/writer.rb
|
|
57
59
|
- lib/legion/extensions/influxdb/version.rb
|
|
58
|
-
homepage: https://
|
|
60
|
+
homepage: https://github.com/LegionIO/lex-influxdb
|
|
59
61
|
licenses:
|
|
60
62
|
- MIT
|
|
61
63
|
metadata:
|
|
62
|
-
homepage_uri: https://
|
|
63
|
-
source_code_uri: https://
|
|
64
|
-
changelog_uri: https://
|
|
65
|
-
|
|
64
|
+
homepage_uri: https://github.com/LegionIO/lex-influxdb
|
|
65
|
+
source_code_uri: https://github.com/LegionIO/lex-influxdb
|
|
66
|
+
changelog_uri: https://github.com/LegionIO/lex-influxdb/blob/main/CHANGELOG.md
|
|
67
|
+
rubygems_mfa_required: 'true'
|
|
66
68
|
rdoc_options: []
|
|
67
69
|
require_paths:
|
|
68
70
|
- lib
|
|
@@ -70,15 +72,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
70
72
|
requirements:
|
|
71
73
|
- - ">="
|
|
72
74
|
- !ruby/object:Gem::Version
|
|
73
|
-
version:
|
|
75
|
+
version: '3.4'
|
|
74
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
77
|
requirements:
|
|
76
78
|
- - ">="
|
|
77
79
|
- !ruby/object:Gem::Version
|
|
78
80
|
version: '0'
|
|
79
81
|
requirements: []
|
|
80
|
-
rubygems_version: 3.
|
|
81
|
-
signing_key:
|
|
82
|
+
rubygems_version: 3.6.9
|
|
82
83
|
specification_version: 4
|
|
83
84
|
summary: LEX::Influxdb
|
|
84
85
|
test_files: []
|
data/.idea/lex-influxdb.iml
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="RUBY_MODULE" version="4">
|
|
3
|
-
<component name="ModuleRunConfigurationManager">
|
|
4
|
-
<shared />
|
|
5
|
-
</component>
|
|
6
|
-
<component name="NewModuleRootManager">
|
|
7
|
-
<content url="file://$MODULE_DIR$" />
|
|
8
|
-
<orderEntry type="inheritedJdk" />
|
|
9
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, RVM: ruby-2.6.3) [gem]" level="application" />
|
|
11
|
-
<orderEntry type="library" scope="PROVIDED" name="chef (v15.8.23, RVM: ruby-2.6.3) [gem]" level="application" />
|
|
12
|
-
<orderEntry type="library" scope="PROVIDED" name="influxdb (v0.8.0, RVM: ruby-2.6.3) [gem]" level="application" />
|
|
13
|
-
</component>
|
|
14
|
-
</module>
|