influxdb-rails 1.0.1.beta2 → 1.0.3
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/rubocop.yml +18 -0
- data/.github/workflows/spec.yml +32 -0
- data/.rubocop.yml +36 -7
- data/CHANGELOG.md +22 -1
- data/README.md +43 -34
- data/gemfiles/Gemfile.rails-6.0.x +1 -2
- data/gemfiles/Gemfile.rails-6.1.x +9 -0
- data/influxdb-rails.gemspec +2 -2
- data/lib/influxdb/rails/middleware/active_job_subscriber.rb +11 -11
- data/lib/influxdb/rails/middleware/request_subscriber.rb +9 -1
- data/lib/influxdb/rails/railtie.rb +0 -1
- data/lib/influxdb/rails/sql/normalizer.rb +3 -3
- data/lib/influxdb/rails/tags.rb +2 -2
- data/lib/influxdb/rails/values.rb +1 -1
- data/lib/influxdb/rails/version.rb +1 -1
- data/lib/influxdb-rails.rb +1 -2
- data/lib/rails/generators/influxdb/templates/initializer.rb +4 -0
- data/sample-dashboard/Dockerfile +2 -2
- data/sample-dashboard/README.md +21 -28
- data/sample-dashboard/Rakefile +10 -5
- data/sample-dashboard/Ruby On Rails ActiveJob.json +600 -0
- data/sample-dashboard/{Ruby On Rails Performance (per Action).json → Ruby On Rails Performance per Action.json } +343 -589
- data/sample-dashboard/{Ruby On Rails Performance (per Request).json → Ruby On Rails Performance per Request.json } +361 -211
- data/sample-dashboard/Ruby On Rails Performance.json +1347 -1139
- data/sample-dashboard/Ruby On Rails Requests.json +834 -0
- data/sample-dashboard/Ruby On Rails Slowlog by Action.json +278 -0
- data/sample-dashboard/Ruby On Rails Slowlog by Request.json +277 -0
- data/sample-dashboard/Ruby On Rails Slowlog by SQL.json +328 -0
- data/sample-dashboard/docker-compose.yml +6 -1
- data/sample-dashboard/provisioning/activejob.json +600 -0
- data/sample-dashboard/provisioning/performance-action.json +334 -580
- data/sample-dashboard/provisioning/performance-request.json +355 -205
- data/sample-dashboard/provisioning/performance.json +1336 -1128
- data/sample-dashboard/provisioning/requests.json +834 -0
- data/sample-dashboard/provisioning/slowlog-action.json +278 -0
- data/sample-dashboard/provisioning/slowlog-requests.json +277 -0
- data/sample-dashboard/provisioning/slowlog-sql.json +328 -0
- data/spec/requests/action_controller_metrics_spec.rb +24 -10
- data/spec/requests/action_mailer_deliver_metrics_spec.rb +4 -11
- data/spec/requests/action_view_collection_metrics_spec.rb +7 -16
- data/spec/requests/action_view_partial_metrics_spec.rb +6 -15
- data/spec/requests/action_view_template_metrics_spec.rb +6 -15
- data/spec/requests/active_job_enqueue_metrics_spec.rb +6 -15
- data/spec/requests/active_job_perform_metrics_spec.rb +5 -11
- data/spec/requests/active_record_instantiation_metrics_spec.rb +7 -16
- data/spec/requests/active_record_sql_metrics_spec.rb +13 -29
- data/spec/requests/block_inistrumentation_spec.rb +8 -17
- data/spec/requests/context_spec.rb +1 -1
- data/spec/requests/logger_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- data/spec/support/rails5/app.rb +3 -4
- data/spec/support/rails6/app.rb +3 -4
- data/spec/unit/tags.rb +47 -0
- metadata +25 -14
- data/.travis.yml +0 -28
- data/spec/requests/active_job_perform_start_metrics_spec.rb +0 -68
data/spec/unit/tags.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe InfluxDB::Rails::Tags do
|
4
|
+
let(:config) { InfluxDB::Rails::Configuration.new }
|
5
|
+
|
6
|
+
describe ".to_h" do
|
7
|
+
it "returns TrueClass" do
|
8
|
+
subject = InfluxDB::Rails::Tags.new(config: config, tags: { hans: true })
|
9
|
+
expect(subject.to_h).to a_hash_including(hans: true)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "returns FalseClass" do
|
13
|
+
subject = InfluxDB::Rails::Tags.new(config: config, tags: { hans: false })
|
14
|
+
expect(subject.to_h).to a_hash_including(hans: false)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns strings" do
|
18
|
+
subject = InfluxDB::Rails::Tags.new(config: config, tags: { hans: "franz" })
|
19
|
+
expect(subject.to_h).to a_hash_including(hans: "franz")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns strings containing blank" do
|
23
|
+
subject = InfluxDB::Rails::Tags.new(config: config, tags: { hans: "franz hans" })
|
24
|
+
expect(subject.to_h).to a_hash_including(hans: "franz hans")
|
25
|
+
end
|
26
|
+
|
27
|
+
it "removes empty strings" do
|
28
|
+
subject = InfluxDB::Rails::Tags.new(config: config, tags: { hans: "", franz: " " })
|
29
|
+
expect(subject.to_h).not_to a_hash_including(hans: "", franz: " ")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "returns symbols" do
|
33
|
+
subject = InfluxDB::Rails::Tags.new(config: config, tags: { hans: :franz })
|
34
|
+
expect(subject.to_h).to a_hash_including(hans: :franz)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "removes nil" do
|
38
|
+
subject = InfluxDB::Rails::Tags.new(config: config, tags: { hans: nil })
|
39
|
+
expect(subject.to_h).not_to a_hash_including(hans: nil)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "leaves arrays alone" do
|
43
|
+
subject = InfluxDB::Rails::Tags.new(config: config, tags: { hans: [], franz: %w[a b] })
|
44
|
+
expect(subject.to_h).to a_hash_including(hans: [], franz: %w[a b])
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: influxdb-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Bruckmayer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-09-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: influxdb
|
@@ -205,14 +205,14 @@ dependencies:
|
|
205
205
|
requirements:
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
208
|
+
version: 1.9.0
|
209
209
|
type: :development
|
210
210
|
prerelease: false
|
211
211
|
version_requirements: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
213
|
- - "~>"
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version:
|
215
|
+
version: 1.9.0
|
216
216
|
- !ruby/object:Gem::Dependency
|
217
217
|
name: sqlite3
|
218
218
|
requirement: !ruby/object:Gem::Requirement
|
@@ -250,10 +250,11 @@ extensions: []
|
|
250
250
|
extra_rdoc_files: []
|
251
251
|
files:
|
252
252
|
- ".github/dependabot.yml"
|
253
|
+
- ".github/workflows/rubocop.yml"
|
254
|
+
- ".github/workflows/spec.yml"
|
253
255
|
- ".gitignore"
|
254
256
|
- ".rspec"
|
255
257
|
- ".rubocop.yml"
|
256
|
-
- ".travis.yml"
|
257
258
|
- CHANGELOG.md
|
258
259
|
- Gemfile
|
259
260
|
- LICENSE.txt
|
@@ -262,6 +263,7 @@ files:
|
|
262
263
|
- config.ru
|
263
264
|
- gemfiles/Gemfile.rails-5.2.x
|
264
265
|
- gemfiles/Gemfile.rails-6.0.x
|
266
|
+
- gemfiles/Gemfile.rails-6.1.x
|
265
267
|
- influxdb-rails.gemspec
|
266
268
|
- lib/influxdb-rails.rb
|
267
269
|
- lib/influxdb/rails/configuration.rb
|
@@ -288,15 +290,25 @@ files:
|
|
288
290
|
- sample-dashboard/Dockerfile
|
289
291
|
- sample-dashboard/README.md
|
290
292
|
- sample-dashboard/Rakefile
|
291
|
-
- sample-dashboard/Ruby On Rails
|
292
|
-
- sample-dashboard/Ruby On Rails Performance
|
293
|
+
- sample-dashboard/Ruby On Rails ActiveJob.json
|
294
|
+
- sample-dashboard/Ruby On Rails Performance per Action.json
|
295
|
+
- sample-dashboard/Ruby On Rails Performance per Request.json
|
293
296
|
- sample-dashboard/Ruby On Rails Performance.json
|
297
|
+
- sample-dashboard/Ruby On Rails Requests.json
|
298
|
+
- sample-dashboard/Ruby On Rails Slowlog by Action.json
|
299
|
+
- sample-dashboard/Ruby On Rails Slowlog by Request.json
|
300
|
+
- sample-dashboard/Ruby On Rails Slowlog by SQL.json
|
294
301
|
- sample-dashboard/docker-compose.yml
|
302
|
+
- sample-dashboard/provisioning/activejob.json
|
295
303
|
- sample-dashboard/provisioning/grafana-dashboards.yml
|
296
304
|
- sample-dashboard/provisioning/grafana-datasource.yml
|
297
305
|
- sample-dashboard/provisioning/performance-action.json
|
298
306
|
- sample-dashboard/provisioning/performance-request.json
|
299
307
|
- sample-dashboard/provisioning/performance.json
|
308
|
+
- sample-dashboard/provisioning/requests.json
|
309
|
+
- sample-dashboard/provisioning/slowlog-action.json
|
310
|
+
- sample-dashboard/provisioning/slowlog-requests.json
|
311
|
+
- sample-dashboard/provisioning/slowlog-sql.json
|
300
312
|
- spec/requests/action_controller_metrics_spec.rb
|
301
313
|
- spec/requests/action_mailer_deliver_metrics_spec.rb
|
302
314
|
- spec/requests/action_view_collection_metrics_spec.rb
|
@@ -304,7 +316,6 @@ files:
|
|
304
316
|
- spec/requests/action_view_template_metrics_spec.rb
|
305
317
|
- spec/requests/active_job_enqueue_metrics_spec.rb
|
306
318
|
- spec/requests/active_job_perform_metrics_spec.rb
|
307
|
-
- spec/requests/active_job_perform_start_metrics_spec.rb
|
308
319
|
- spec/requests/active_record_instantiation_metrics_spec.rb
|
309
320
|
- spec/requests/active_record_sql_metrics_spec.rb
|
310
321
|
- spec/requests/block_inistrumentation_spec.rb
|
@@ -322,6 +333,7 @@ files:
|
|
322
333
|
- spec/unit/configuration_spec.rb
|
323
334
|
- spec/unit/sql/normalizer_spec.rb
|
324
335
|
- spec/unit/sql/query_spec.rb
|
336
|
+
- spec/unit/tags.rb
|
325
337
|
homepage: https://influxdata.com
|
326
338
|
licenses:
|
327
339
|
- MIT
|
@@ -338,15 +350,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
338
350
|
requirements:
|
339
351
|
- - ">="
|
340
352
|
- !ruby/object:Gem::Version
|
341
|
-
version: 2.
|
353
|
+
version: 2.5.0
|
342
354
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
343
355
|
requirements:
|
344
|
-
- - "
|
356
|
+
- - ">="
|
345
357
|
- !ruby/object:Gem::Version
|
346
|
-
version:
|
358
|
+
version: '0'
|
347
359
|
requirements: []
|
348
|
-
|
349
|
-
rubygems_version: 2.7.6.2
|
360
|
+
rubygems_version: 3.1.6
|
350
361
|
signing_key:
|
351
362
|
specification_version: 4
|
352
363
|
summary: InfluxDB bindings for Ruby on Rails.
|
@@ -358,7 +369,6 @@ test_files:
|
|
358
369
|
- spec/requests/action_view_template_metrics_spec.rb
|
359
370
|
- spec/requests/active_job_enqueue_metrics_spec.rb
|
360
371
|
- spec/requests/active_job_perform_metrics_spec.rb
|
361
|
-
- spec/requests/active_job_perform_start_metrics_spec.rb
|
362
372
|
- spec/requests/active_record_instantiation_metrics_spec.rb
|
363
373
|
- spec/requests/active_record_sql_metrics_spec.rb
|
364
374
|
- spec/requests/block_inistrumentation_spec.rb
|
@@ -376,3 +386,4 @@ test_files:
|
|
376
386
|
- spec/unit/configuration_spec.rb
|
377
387
|
- spec/unit/sql/normalizer_spec.rb
|
378
388
|
- spec/unit/sql/query_spec.rb
|
389
|
+
- spec/unit/tags.rb
|
data/.travis.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
sudo: required
|
2
|
-
dist: trusty
|
3
|
-
language: ruby
|
4
|
-
before_install:
|
5
|
-
- gem update --system --no-doc
|
6
|
-
- gem install bundler --no-doc
|
7
|
-
- gem update bundler --no-doc
|
8
|
-
rvm:
|
9
|
-
- ruby-head
|
10
|
-
- "2.7"
|
11
|
-
- "2.6"
|
12
|
-
- "2.5"
|
13
|
-
gemfile:
|
14
|
-
- gemfiles/Gemfile.rails-6.0.x
|
15
|
-
- gemfiles/Gemfile.rails-5.2.x
|
16
|
-
env:
|
17
|
-
- TEST_TASK=spec
|
18
|
-
matrix:
|
19
|
-
allow_failures:
|
20
|
-
- rvm: ruby-head
|
21
|
-
include:
|
22
|
-
- { rvm: "2.6", gemfile: "Gemfile", env: [TEST_TASK=rubocop] }
|
23
|
-
addons:
|
24
|
-
apt:
|
25
|
-
packages:
|
26
|
-
- haveged
|
27
|
-
- libgmp-dev
|
28
|
-
script: bundle exec rake $TEST_TASK
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe "ActiveJob start metrics", type: :request do
|
4
|
-
let(:tags_middleware) do
|
5
|
-
lambda do |tags|
|
6
|
-
tags.merge(tags_middleware: :tags_middleware)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
before do
|
10
|
-
allow_any_instance_of(InfluxDB::Rails::Configuration).to receive(:ignored_environments).and_return(%w[development])
|
11
|
-
allow_any_instance_of(ActionDispatch::Request).to receive(:request_id).and_return(:request_id)
|
12
|
-
allow_any_instance_of(InfluxDB::Rails::Configuration).to receive(:application_name).and_return(:app_name)
|
13
|
-
allow_any_instance_of(InfluxDB::Rails::Configuration).to receive(:tags_middleware).and_return(tags_middleware)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "writes metric" do
|
17
|
-
perform_enqueued_jobs do
|
18
|
-
get "/metrics"
|
19
|
-
end
|
20
|
-
|
21
|
-
expect_metric(
|
22
|
-
tags: a_hash_including(
|
23
|
-
location: "MetricsController#index",
|
24
|
-
hook: "perform_start",
|
25
|
-
state: "running",
|
26
|
-
job: "MetricJob",
|
27
|
-
queue: "default",
|
28
|
-
server: Socket.gethostname,
|
29
|
-
app_name: :app_name,
|
30
|
-
tags_middleware: :tags_middleware
|
31
|
-
),
|
32
|
-
values: a_hash_including(
|
33
|
-
value: 1
|
34
|
-
)
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
it "includes correct timestamps" do
|
39
|
-
travel_to Time.zone.local(2018, 1, 1, 9, 0, 0)
|
40
|
-
|
41
|
-
perform_enqueued_jobs do
|
42
|
-
get "/metrics"
|
43
|
-
end
|
44
|
-
|
45
|
-
expect_metric(
|
46
|
-
tags: a_hash_including(
|
47
|
-
location: "MetricsController#index",
|
48
|
-
hook: "perform_start"
|
49
|
-
),
|
50
|
-
timestamp: 1_514_797_200
|
51
|
-
)
|
52
|
-
end
|
53
|
-
|
54
|
-
it "does not write metric when hook is ignored" do
|
55
|
-
allow_any_instance_of(InfluxDB::Rails::Configuration).to receive(:ignored_hooks).and_return(["perform_start.active_job"])
|
56
|
-
|
57
|
-
perform_enqueued_jobs do
|
58
|
-
get "/metrics"
|
59
|
-
end
|
60
|
-
|
61
|
-
expect_no_metric(
|
62
|
-
tags: a_hash_including(
|
63
|
-
location: "MetricsController#index",
|
64
|
-
hook: "perform_start"
|
65
|
-
)
|
66
|
-
)
|
67
|
-
end
|
68
|
-
end
|