influxdb-rails 1.0.0.beta3 → 1.0.0.beta4
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/.rubocop.yml +5 -0
- data/CHANGELOG.md +12 -10
- data/README.md +193 -168
- data/influxdb-rails.gemspec +13 -7
- data/lib/influxdb/rails/configuration.rb +88 -192
- data/lib/influxdb/rails/context.rb +19 -1
- data/lib/influxdb/rails/instrumentation.rb +4 -4
- data/lib/influxdb/rails/middleware/render_subscriber.rb +7 -0
- data/lib/influxdb/rails/middleware/request_subscriber.rb +22 -24
- data/lib/influxdb/rails/middleware/simple_subscriber.rb +12 -25
- data/lib/influxdb/rails/middleware/sql_subscriber.rb +7 -3
- data/lib/influxdb/rails/middleware/subscriber.rb +19 -8
- data/lib/influxdb/rails/railtie.rb +29 -32
- data/lib/influxdb/rails/version.rb +1 -1
- data/lib/influxdb-rails.rb +20 -81
- data/lib/rails/generators/influxdb/influxdb_generator.rb +1 -1
- data/lib/rails/generators/influxdb/templates/initializer.rb +39 -9
- data/sample-dashboard/Dockerfile +25 -0
- data/sample-dashboard/README.md +74 -0
- data/sample-dashboard/Rakefile +8 -0
- data/sample-dashboard/Ruby On Rails Performance (per Request).json +1053 -0
- data/sample-dashboard/Ruby On Rails Performance.json +2011 -0
- data/sample-dashboard/docker-compose.yml +33 -0
- data/sample-dashboard/provisioning/grafana-dashboards.yml +12 -0
- data/sample-dashboard/provisioning/grafana-datasource.yml +10 -0
- data/sample-dashboard/provisioning/performance-request.json +1053 -0
- data/sample-dashboard/provisioning/performance.json +2011 -0
- data/spec/integration/metrics_spec.rb +12 -13
- data/spec/shared_examples/data.rb +61 -0
- data/spec/spec_helper.rb +3 -1
- data/spec/support/rails4/app.rb +4 -0
- data/spec/support/rails5/app.rb +4 -0
- data/spec/unit/configuration_spec.rb +47 -65
- data/spec/unit/middleware/render_subscriber_spec.rb +13 -9
- data/spec/unit/middleware/request_subscriber_spec.rb +33 -21
- data/spec/unit/middleware/sql_subscriber_spec.rb +35 -8
- metadata +42 -30
- data/lib/influxdb/rails/air_traffic_controller.rb +0 -41
- data/lib/influxdb/rails/backtrace.rb +0 -44
- data/lib/influxdb/rails/exception_presenter.rb +0 -94
- data/lib/influxdb/rails/logger.rb +0 -16
- data/lib/influxdb/rails/middleware/hijack_render_exception.rb +0 -16
- data/lib/influxdb/rails/middleware/hijack_rescue_action_everywhere.rb +0 -31
- data/lib/influxdb/rails/rack.rb +0 -24
- data/spec/integration/exceptions_spec.rb +0 -37
- data/spec/shared_examples/tags.rb +0 -42
- data/spec/unit/backtrace_spec.rb +0 -85
- data/spec/unit/exception_presenter_spec.rb +0 -23
- data/spec/unit/influxdb_rails_spec.rb +0 -78
@@ -1,78 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe InfluxDB::Rails do
|
4
|
-
before do
|
5
|
-
InfluxDB::Rails.configure do |config|
|
6
|
-
config.application_name = "my-rails-app"
|
7
|
-
config.ignored_environments = []
|
8
|
-
config.time_precision = "ms"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
describe ".current_timestamp" do
|
13
|
-
let(:timestamp) { 1_513_009_229_111 }
|
14
|
-
|
15
|
-
it "should return the current timestamp in the configured precision" do
|
16
|
-
expect(Process).to receive(:clock_gettime)
|
17
|
-
.with(Process::CLOCK_REALTIME, :millisecond)
|
18
|
-
.and_return(timestamp)
|
19
|
-
|
20
|
-
expect(InfluxDB::Rails.current_timestamp).to eq(timestamp)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe ".ignorable_exception?" do
|
25
|
-
it "should be true for exception types specified in the configuration" do
|
26
|
-
class DummyException < RuntimeError; end
|
27
|
-
exception = DummyException.new
|
28
|
-
|
29
|
-
InfluxDB::Rails.configure do |config|
|
30
|
-
config.ignored_exceptions << "DummyException"
|
31
|
-
end
|
32
|
-
|
33
|
-
expect(InfluxDB::Rails.ignorable_exception?(exception)).to be_truthy
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should be true for exception types specified in the configuration" do
|
37
|
-
exception = ActionController::RoutingError.new("foo")
|
38
|
-
expect(InfluxDB::Rails.ignorable_exception?(exception)).to be_truthy
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should be false for valid exceptions" do
|
42
|
-
exception = ZeroDivisionError.new
|
43
|
-
expect(InfluxDB::Rails.ignorable_exception?(exception)).to be_falsey
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "rescue" do
|
48
|
-
it "should transmit an exception when passed" do
|
49
|
-
expect(InfluxDB::Rails.client).to receive(:write_point)
|
50
|
-
|
51
|
-
InfluxDB::Rails.rescue do
|
52
|
-
raise ArgumentError, "wrong"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should also raise the exception when in an ignored environment" do
|
57
|
-
InfluxDB::Rails.configure do |config|
|
58
|
-
config.ignored_environments = %w[development test]
|
59
|
-
end
|
60
|
-
|
61
|
-
expect do
|
62
|
-
InfluxDB::Rails.rescue do
|
63
|
-
raise ArgumentError, "wrong"
|
64
|
-
end
|
65
|
-
end.to raise_error(ArgumentError)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe "rescue_and_reraise" do
|
70
|
-
it "should transmit an exception when passed" do
|
71
|
-
expect(InfluxDB::Rails.client).to receive(:write_point)
|
72
|
-
|
73
|
-
expect do
|
74
|
-
InfluxDB::Rails.rescue_and_reraise { raise ArgumentError, "wrong" }
|
75
|
-
end.to raise_error(ArgumentError)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|