lex-influxdb 0.1.2 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed3d5e8ac4f393e87b8051e804f0dca5986acfa295b3311874e9c3225a2de543
4
- data.tar.gz: 822d4205e2ee398f6039c247739a644df0b2396bca25e44cdc11a7e6b5e97832
3
+ metadata.gz: a6317e42ec248c5831ca02c14bb6605b04fc16c071e0cbd22be82c77321a65c3
4
+ data.tar.gz: '09ba693382aa32d408aaed540f76261ede601e50eb9427ef5c92d91a71e42db6'
5
5
  SHA512:
6
- metadata.gz: ba9df55e0fe0dc9930c113d13c7d7610e1e70f5f484ec78b4b1073bc067950ff440a4f2f14f0d85791f416596b32d8ecaf57491826b43255fa51d4e2713d5730
7
- data.tar.gz: f2f33e818f035668f96ab6c10ec809202656e4058ea92517d15f52ec5f4f1d88f6a8283e53683cc29d94db2abd7d59e6fe9287f148c2d7df60cd3a3259a87bd2
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,28 +1,48 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.4
3
+ NewCops: enable
4
+ SuggestExtensions: false
5
+
1
6
  Layout/LineLength:
2
- Max: 120
3
- Metrics/MethodLength:
4
- Max: 30
5
- Metrics/ClassLength:
6
- Max: 1500
7
- Metrics/BlockLength:
8
- Max: 50
9
- Metrics/ParameterLists:
10
- Max: 10
7
+ Max: 160
8
+
11
9
  Layout/SpaceAroundEqualsInParameterDefault:
12
10
  EnforcedStyle: space
13
- Style/SymbolArray:
14
- Enabled: true
11
+
15
12
  Layout/HashAlignment:
16
13
  EnforcedHashRocketStyle: table
17
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
+
18
37
  Style/Documentation:
19
38
  Enabled: false
20
- AllCops:
21
- TargetRubyVersion: 2.5
22
- NewCops: enable
39
+
40
+ Style/SymbolArray:
41
+ Enabled: true
42
+
23
43
  Style/FrozenStringLiteralComment:
24
- Enabled: false
44
+ Enabled: true
45
+ EnforcedStyle: always
46
+
25
47
  Naming/FileName:
26
48
  Enabled: false
27
- Style/ClassAndModuleChildren:
28
- 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
@@ -2,5 +2,9 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- # Specify your gem's dependencies in legion-extensions-influxdb.gemspec
6
5
  gemspec
6
+ gem 'legionio'
7
+ gem 'rake', '~> 12.0'
8
+ gem 'rspec', '~> 3.0'
9
+ gem 'rubocop'
10
+ gem 'simplecov'
data/Gemfile.lock CHANGED
@@ -1,135 +1,158 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lex-influxdb (0.1.2)
4
+ lex-influxdb (0.2.0)
5
5
  influxdb
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- amq-protocol (2.3.2)
11
- ast (2.4.1)
12
- aws-eventstream (1.1.0)
13
- aws-sigv4 (1.2.2)
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)
14
16
  aws-eventstream (~> 1, >= 1.0.2)
15
- bunny (2.16.1)
16
- amq-protocol (~> 2.3, >= 2.3.1)
17
- concurrent-ruby (1.1.7)
18
- concurrent-ruby-ext (1.1.7)
19
- concurrent-ruby (= 1.1.7)
20
- connection_pool (2.2.3)
21
- daemons (1.3.1)
22
- dalli (2.7.10)
23
- diff-lcs (1.4.4)
24
- docile (1.3.2)
25
- faraday (1.0.1)
26
- multipart-post (>= 1.2, < 3)
27
- faraday_middleware (1.0.0)
28
- faraday (~> 1.0)
29
- ffi (1.13.1)
30
- hashdiff (1.0.1)
31
- influxdb (0.8.0)
32
- legion-cache (1.0.0)
33
- connection_pool
34
- dalli
35
- redis
36
- legion-crypt (0.2.0)
37
- rbnacl
38
- vault
39
- legion-data (0.2.0)
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)
40
41
  legion-logging
41
42
  legion-settings
42
- mysql2
43
- sequel
44
- legion-exceptions (1.1.0)
45
- legion-json (1.1.0)
43
+ redis (>= 4.2)
44
+ legion-crypt (1.2.0)
45
+ vault (>= 0.15.0)
46
+ legion-json (1.2.0)
47
+ json_pure
46
48
  multi_json
47
- legion-logging (1.1.0)
49
+ legion-logging (1.2.0)
48
50
  rainbow (~> 3)
49
- legion-settings (1.1.1)
50
- legion-json
51
- legion-logging
52
- legion-transport (1.1.1)
53
- bunny
54
- concurrent-ruby
55
- legionio (0.2.0)
56
- concurrent-ruby
57
- concurrent-ruby-ext
58
- daemons
59
- hashdiff
60
- legion-cache
61
- legion-crypt
62
- legion-data
63
- legion-exceptions
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)
64
56
  legion-json
65
- legion-logging
66
57
  legion-settings
67
- legion-transport
68
- sleepiq
69
- vault
70
- multi_json (1.15.0)
71
- multipart-post (2.1.1)
72
- mysql2 (0.5.3)
73
- parallel (1.19.2)
74
- parser (2.7.1.4)
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)
75
85
  ast (~> 2.4.1)
76
- rainbow (3.0.0)
77
- rake (13.0.1)
78
- rbnacl (7.1.1)
79
- ffi
80
- redis (4.2.1)
81
- regexp_parser (1.7.1)
82
- rexml (3.2.4)
83
- rspec (3.9.0)
84
- rspec-core (~> 3.9.0)
85
- rspec-expectations (~> 3.9.0)
86
- rspec-mocks (~> 3.9.0)
87
- rspec-core (3.9.2)
88
- rspec-support (~> 3.9.3)
89
- rspec-expectations (3.9.2)
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)
90
105
  diff-lcs (>= 1.2.0, < 2.0)
91
- rspec-support (~> 3.9.0)
92
- rspec-mocks (3.9.1)
106
+ rspec-support (~> 3.13.0)
107
+ rspec-mocks (3.13.8)
93
108
  diff-lcs (>= 1.2.0, < 2.0)
94
- rspec-support (~> 3.9.0)
95
- rspec-support (3.9.3)
96
- rubocop (0.89.1)
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)
97
116
  parallel (~> 1.10)
98
- parser (>= 2.7.1.1)
117
+ parser (>= 3.3.0.2)
99
118
  rainbow (>= 2.2.2, < 4.0)
100
- regexp_parser (>= 1.7)
101
- rexml
102
- rubocop-ast (>= 0.3.0, < 1.0)
119
+ regexp_parser (>= 2.9.3, < 3.0)
120
+ rubocop-ast (>= 1.49.0, < 2.0)
103
121
  ruby-progressbar (~> 1.7)
104
- unicode-display_width (>= 1.4.0, < 2.0)
105
- rubocop-ast (0.3.0)
106
- parser (>= 2.7.1.4)
107
- ruby-progressbar (1.10.1)
108
- sequel (5.35.0)
109
- simplecov (0.19.0)
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)
110
128
  docile (~> 1.1)
111
129
  simplecov-html (~> 0.11)
112
- simplecov-html (0.12.2)
113
- sleepiq (0.2.2)
114
- dalli
115
- faraday
116
- faraday_middleware
117
- thor
118
- thor (1.0.1)
119
- unicode-display_width (1.7.0)
120
- vault (0.15.0)
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)
121
140
  aws-sigv4
141
+ base64
142
+ connection_pool (~> 2.4)
143
+ net-http-persistent (~> 4.0, >= 4.0.2)
122
144
 
123
145
  PLATFORMS
146
+ arm64-darwin-25
124
147
  ruby
125
148
 
126
149
  DEPENDENCIES
127
150
  legionio
128
151
  lex-influxdb!
129
- rake
130
- rspec
152
+ rake (~> 12.0)
153
+ rspec (~> 3.0)
131
154
  rubocop
132
155
  simplecov
133
156
 
134
157
  BUNDLED WITH
135
- 2.1.4
158
+ 2.6.9
data/README.md CHANGED
@@ -1,38 +1,38 @@
1
- # Legion::Extensions::Influxdb
1
+ # lex-influxdb
2
2
 
3
- Used to connect Legion with InfluxDB
3
+ InfluxDB integration for [LegionIO](https://github.com/LegionIO/LegionIO). Read, write, and manage InfluxDB time-series databases.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
7
+ ```bash
8
+ gem install lex-influxdb
9
+ ```
10
+
11
+ Or add to your Gemfile:
8
12
 
9
13
  ```ruby
10
14
  gem 'lex-influxdb'
11
15
  ```
12
16
 
13
- And then execute:
14
-
15
- $ bundle install
17
+ ## Runners
16
18
 
17
- Or install it yourself as:
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 |
18
29
 
19
- $ gem install lex-influxdb
20
-
21
- ## Adding to Legion
22
- You can manually install with a `gem install lex-influxdb` command or by adding it into your settings with something like this
23
- ```json
24
- {
25
- "extensions": {
26
- "influxdb": {
27
- "enabled": true, "workers": 1
28
- }
29
- }
30
- }
31
- ```
30
+ ## Requirements
32
31
 
33
- ## Usage
34
- *To be updated*
32
+ - Ruby >= 3.4
33
+ - [LegionIO](https://github.com/LegionIO/LegionIO) framework
34
+ - InfluxDB server (default: localhost:8086)
35
35
 
36
36
  ## License
37
37
 
38
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
38
+ MIT
@@ -10,13 +10,14 @@ 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://bitbucket.org/legion-io/lex-influxdb'
13
+ spec.homepage = 'https://github.com/LegionIO/lex-influxdb'
14
14
  spec.license = 'MIT'
15
- spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
15
+ spec.required_ruby_version = '>= 3.4'
16
16
 
17
17
  spec.metadata['homepage_uri'] = spec.homepage
18
- spec.metadata['source_code_uri'] = 'https://bitbucket.org/legion-io/lex-influxdb/src'
19
- spec.metadata['changelog_uri'] = 'https://bitbucket.org/legion-io/lex-influxdb/src/master/CHANGELOG.md'
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.
@@ -27,9 +28,4 @@ Gem::Specification.new do |spec|
27
28
  spec.require_paths = ['lib']
28
29
 
29
30
  spec.add_dependency 'influxdb'
30
- spec.add_development_dependency 'rake'
31
- spec.add_development_dependency 'rspec'
32
- spec.add_development_dependency 'rubocop'
33
- spec.add_development_dependency 'legionio'
34
- spec.add_development_dependency 'simplecov'
35
31
  end
@@ -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,17 +1,16 @@
1
- module Legion::Extensions::Influxdb
2
- module Helpers
3
- module Client
4
- def client(**_opts)
5
- # @client ||= InfluxBD::Client.new
6
- @client ||= InfluxBD::Client.new('esphome', { host: 'influx.home.whonodes.org', async: false })
7
- end
1
+ # frozen_string_literal: true
8
2
 
9
- def host
10
- 'localhost'
11
- end
3
+ module Legion
4
+ module Extensions
5
+ module Influxdb
6
+ module Helpers
7
+ module Client
8
+ module_function
12
9
 
13
- def port
14
- 8086
10
+ def client(host: 'localhost', port: 8086, database: nil, **)
11
+ InfluxDB::Client.new(database, host: host, port: port, async: false, **)
12
+ end
13
+ end
15
14
  end
16
15
  end
17
16
  end
@@ -1,11 +1,17 @@
1
- module Legion::Extensions::Influxdb
2
- module Runners
3
- module Cluster
4
- def self.create(payload); end
1
+ # frozen_string_literal: true
5
2
 
6
- def self.list(payload = {}); end
3
+ module Legion
4
+ module Extensions
5
+ module Influxdb
6
+ module Runners
7
+ module Cluster
8
+ def self.create(payload); end
7
9
 
8
- def self.revoke(payload); end
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
- module Legion::Extensions::Influxdb
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
- def self.create(name:, host: 'localhost', port: 8086, **_payload)
9
- client = InfluxDB::Client.new(host: host, port: port)
10
- end
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
- def self.delete(name:, host: 'localhost', port: 8086, **_payload)
13
- client = InfluxDB::Client.new(host: host, port: port)
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
- module Legion::Extensions::Influxdb
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
- def self.delete(name:, host: 'localhost', port: 8086, **payload)
17
- client = InfluxDB::Client.new(host: payload[:host])
18
- client.delete_database(payload[:name])
19
- end
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
- def self.list(host: 'localhost', port: 8086, **payload)
22
- InfluxDB::Client.new(host: payload[:host]).list_databases
23
- end
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
- def self.field_keys(database: 'telegraf', host: 'localhost', port: 8086, **payload)
26
- client = InfluxDB::Client.new(host: payload[:host], port: port, database: database)
27
- { results: client.show_field_keys, count: client.show_field_keys.count }
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
- module Legion::Extensions::Influxdb
2
- module Runners
3
- module Measurement
4
- def self.list(payload); end
1
+ # frozen_string_literal: true
5
2
 
6
- def self.delete(payload); end
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
- module Legion::Extensions::Influxdb
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
- def create(database:, host: 'localhost', port: 8086, **payload)
8
- InfluxDB::Client.new(host: payload[:host]).list_retention_policies(database)
9
- end
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
- def list(database:, host: 'localhost', port: 8086, **payload)
12
- InfluxDB::Client.new(host: payload[:host]).list_retention_policies(database)
13
- end
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
- def self.delete(payload); end
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
- def self.alter(payload); end
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,6 +1,12 @@
1
- module Legion::Extensions::Influxdb
2
- module Runners
3
- module Series
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Influxdb
6
+ module Runners
7
+ module Series
8
+ end
9
+ end
4
10
  end
5
11
  end
6
12
  end
@@ -1,17 +1,23 @@
1
- module Legion::Extensions::Influxdb
2
- module Runners
3
- module User
4
- def self.create(payload); end
1
+ # frozen_string_literal: true
5
2
 
6
- def self.update_password(payload); end
3
+ module Legion
4
+ module Extensions
5
+ module Influxdb
6
+ module Runners
7
+ module User
8
+ def self.create(payload); end
7
9
 
8
- def self.grant_user_admin_privileges(payload); end
10
+ def self.update_password(payload); end
9
11
 
10
- def self.grant_user_privileges(payload); end
12
+ def self.grant_user_admin_privileges(payload); end
11
13
 
12
- def self.delete(payload); end
14
+ def self.grant_user_privileges(payload); end
13
15
 
14
- def self.list(payload); end
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,24 +1,40 @@
1
- module Legion::Extensions::Influxdb
2
- module Runners
3
- module Writer
4
- def self.write(series:, tags:, values:, host: 'localhost', port: 8086, database:, **_opts)
5
- client = InfluxDB::Client.new(database, host: host, port: port)
6
- {}
7
- end
1
+ # frozen_string_literal: true
8
2
 
9
- def self.write_points(metrics:, host: 'localhost', port: 8086, database: 'telegraf', time_precision: 'ms', **_opts)
10
- settings[:client] ||= InfluxDB::Client.new(database, host: host, port: port, async: false)
11
- metrics = Legion::JSON.load(metrics) if metrics.is_a? String
12
- if metrics[:timestamp].nil?
13
- metrics[:timestamp] = Time.now.to_i
14
- time_precision = 's'
15
- end
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
16
17
 
17
- settings[:client].write_point('sensors', metrics, time_precision)
18
- {}
19
- end
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
20
29
 
21
- include Legion::Extensions::Helpers::Lex
30
+ c = Helpers::Client.client(host: host, port: port, database: database, **extra)
31
+ c.write_point('sensors', metrics, time_precision)
32
+ {}
33
+ end
34
+
35
+ include Legion::Extensions::Helpers::Lex
36
+ end
37
+ end
22
38
  end
23
39
  end
24
40
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Legion
2
4
  module Extensions
3
5
  module Influxdb
4
- VERSION = '0.1.2'.freeze
6
+ VERSION = '0.2.0'
5
7
  end
6
8
  end
7
9
  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.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2020-08-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: influxdb
@@ -24,76 +23,6 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: legionio
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: simplecov
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
26
  description: Used to connect Legion to influxdb
98
27
  email:
99
28
  - matthewdiverson@gmail.com
@@ -102,9 +31,12 @@ extensions: []
102
31
  extra_rdoc_files: []
103
32
  files:
104
33
  - ".circleci/config.yml"
34
+ - ".github/workflows/ci.yml"
105
35
  - ".gitignore"
106
36
  - ".rspec"
107
37
  - ".rubocop.yml"
38
+ - CHANGELOG.md
39
+ - CLAUDE.md
108
40
  - Gemfile
109
41
  - Gemfile.lock
110
42
  - LICENSE.txt
@@ -114,6 +46,7 @@ files:
114
46
  - bin/setup
115
47
  - legion-extensions-influxdb.gemspec
116
48
  - lib/legion/extensions/influxdb.rb
49
+ - lib/legion/extensions/influxdb/client.rb
117
50
  - lib/legion/extensions/influxdb/helpers/client.rb
118
51
  - lib/legion/extensions/influxdb/runners/cluster.rb
119
52
  - lib/legion/extensions/influxdb/runners/continuous_query.rb
@@ -124,14 +57,14 @@ files:
124
57
  - lib/legion/extensions/influxdb/runners/user.rb
125
58
  - lib/legion/extensions/influxdb/runners/writer.rb
126
59
  - lib/legion/extensions/influxdb/version.rb
127
- homepage: https://bitbucket.org/legion-io/lex-influxdb
60
+ homepage: https://github.com/LegionIO/lex-influxdb
128
61
  licenses:
129
62
  - MIT
130
63
  metadata:
131
- homepage_uri: https://bitbucket.org/legion-io/lex-influxdb
132
- source_code_uri: https://bitbucket.org/legion-io/lex-influxdb/src
133
- changelog_uri: https://bitbucket.org/legion-io/lex-influxdb/src/master/CHANGELOG.md
134
- post_install_message:
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'
135
68
  rdoc_options: []
136
69
  require_paths:
137
70
  - lib
@@ -139,15 +72,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
72
  requirements:
140
73
  - - ">="
141
74
  - !ruby/object:Gem::Version
142
- version: 2.5.0
75
+ version: '3.4'
143
76
  required_rubygems_version: !ruby/object:Gem::Requirement
144
77
  requirements:
145
78
  - - ">="
146
79
  - !ruby/object:Gem::Version
147
80
  version: '0'
148
81
  requirements: []
149
- rubygems_version: 3.1.2
150
- signing_key:
82
+ rubygems_version: 3.6.9
151
83
  specification_version: 4
152
84
  summary: LEX::Influxdb
153
85
  test_files: []