influx_reporter 1.0.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 +7 -0
- data/.gitignore +7 -0
- data/.rspec +2 -0
- data/.rubocop.yml +51 -0
- data/.travis.yml +42 -0
- data/.yardopts +3 -0
- data/Dockerfile +9 -0
- data/Gemfile +7 -0
- data/HISTORY.md +1 -0
- data/LICENSE +14 -0
- data/README.md +189 -0
- data/Rakefile +27 -0
- data/gemfiles/Gemfile.base +29 -0
- data/gemfiles/Gemfile.rails-3.2.x +4 -0
- data/gemfiles/Gemfile.rails-4.0.x +4 -0
- data/gemfiles/Gemfile.rails-4.1.x +4 -0
- data/gemfiles/Gemfile.rails-4.2.x +5 -0
- data/gemfiles/Gemfile.rails-5.0.x +5 -0
- data/gemfiles/Gemfile.rails-HEAD +7 -0
- data/influx_reporter.gemspec +26 -0
- data/lib/influx_reporter.rb +142 -0
- data/lib/influx_reporter/client.rb +306 -0
- data/lib/influx_reporter/configuration.rb +88 -0
- data/lib/influx_reporter/data_builders.rb +18 -0
- data/lib/influx_reporter/data_builders/error.rb +52 -0
- data/lib/influx_reporter/data_builders/transactions.rb +120 -0
- data/lib/influx_reporter/error.rb +7 -0
- data/lib/influx_reporter/error_message.rb +85 -0
- data/lib/influx_reporter/error_message/exception.rb +14 -0
- data/lib/influx_reporter/error_message/http.rb +73 -0
- data/lib/influx_reporter/error_message/stacktrace.rb +76 -0
- data/lib/influx_reporter/error_message/user.rb +25 -0
- data/lib/influx_reporter/filter.rb +66 -0
- data/lib/influx_reporter/http_client.rb +140 -0
- data/lib/influx_reporter/influx_db_client.rb +74 -0
- data/lib/influx_reporter/injections.rb +89 -0
- data/lib/influx_reporter/injections/json.rb +21 -0
- data/lib/influx_reporter/injections/net_http.rb +50 -0
- data/lib/influx_reporter/injections/redis.rb +25 -0
- data/lib/influx_reporter/injections/sequel.rb +37 -0
- data/lib/influx_reporter/injections/sinatra.rb +59 -0
- data/lib/influx_reporter/integration/delayed_job.rb +30 -0
- data/lib/influx_reporter/integration/rails/inject_exceptions_catcher.rb +25 -0
- data/lib/influx_reporter/integration/railtie.rb +56 -0
- data/lib/influx_reporter/integration/resque.rb +18 -0
- data/lib/influx_reporter/integration/sidekiq.rb +130 -0
- data/lib/influx_reporter/line_cache.rb +21 -0
- data/lib/influx_reporter/logging.rb +39 -0
- data/lib/influx_reporter/middleware.rb +63 -0
- data/lib/influx_reporter/normalizers.rb +65 -0
- data/lib/influx_reporter/normalizers/action_controller.rb +34 -0
- data/lib/influx_reporter/normalizers/action_view.rb +72 -0
- data/lib/influx_reporter/normalizers/active_record.rb +45 -0
- data/lib/influx_reporter/sql_summarizer.rb +31 -0
- data/lib/influx_reporter/subscriber.rb +80 -0
- data/lib/influx_reporter/tasks.rb +28 -0
- data/lib/influx_reporter/trace.rb +48 -0
- data/lib/influx_reporter/trace_helpers.rb +31 -0
- data/lib/influx_reporter/transaction.rb +114 -0
- data/lib/influx_reporter/util.rb +18 -0
- data/lib/influx_reporter/util/constantize.rb +56 -0
- data/lib/influx_reporter/util/inspector.rb +72 -0
- data/lib/influx_reporter/util/timestamp.rb +11 -0
- data/lib/influx_reporter/version.rb +5 -0
- data/lib/influx_reporter/worker.rb +56 -0
- data/spec/influx_reporter/client_spec.rb +264 -0
- data/spec/influx_reporter/configuration_spec.rb +42 -0
- data/spec/influx_reporter/data_builders/error_spec.rb +40 -0
- data/spec/influx_reporter/data_builders/transactions_spec.rb +48 -0
- data/spec/influx_reporter/error_message/exception_spec.rb +22 -0
- data/spec/influx_reporter/error_message/http_spec.rb +55 -0
- data/spec/influx_reporter/error_message/stacktrace_spec.rb +56 -0
- data/spec/influx_reporter/error_message/user_spec.rb +26 -0
- data/spec/influx_reporter/error_message_spec.rb +102 -0
- data/spec/influx_reporter/filter_spec.rb +33 -0
- data/spec/influx_reporter/injections/net_http_spec.rb +35 -0
- data/spec/influx_reporter/injections/sequel_spec.rb +33 -0
- data/spec/influx_reporter/injections/sinatra_spec.rb +13 -0
- data/spec/influx_reporter/injections_spec.rb +50 -0
- data/spec/influx_reporter/integration/delayed_job_spec.rb +37 -0
- data/spec/influx_reporter/integration/json_spec.rb +41 -0
- data/spec/influx_reporter/integration/rails_spec.rb +92 -0
- data/spec/influx_reporter/integration/redis_spec.rb +20 -0
- data/spec/influx_reporter/integration/resque_spec.rb +42 -0
- data/spec/influx_reporter/integration/sidekiq_spec.rb +40 -0
- data/spec/influx_reporter/integration/sinatra_spec.rb +99 -0
- data/spec/influx_reporter/line_cache_spec.rb +38 -0
- data/spec/influx_reporter/logging_spec.rb +49 -0
- data/spec/influx_reporter/middleware_spec.rb +32 -0
- data/spec/influx_reporter/normalizers/action_controller_spec.rb +37 -0
- data/spec/influx_reporter/normalizers/action_view_spec.rb +78 -0
- data/spec/influx_reporter/normalizers/active_record_spec.rb +70 -0
- data/spec/influx_reporter/normalizers_spec.rb +16 -0
- data/spec/influx_reporter/sql_summarizer_spec.rb +35 -0
- data/spec/influx_reporter/subscriber_spec.rb +83 -0
- data/spec/influx_reporter/trace_spec.rb +43 -0
- data/spec/influx_reporter/transaction_spec.rb +98 -0
- data/spec/influx_reporter/util/inspector_spec.rb +41 -0
- data/spec/influx_reporter/util_spec.rb +20 -0
- data/spec/influx_reporter/worker_spec.rb +54 -0
- data/spec/influx_reporter_spec.rb +50 -0
- data/spec/spec_helper.rb +86 -0
- metadata +188 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
ENV['RACK_ENV'] = 'test'
|
4
|
+
|
5
|
+
DEBUG = ENV.fetch('CI', false)
|
6
|
+
|
7
|
+
require 'bundler/setup'
|
8
|
+
Bundler.require :default
|
9
|
+
require 'timecop'
|
10
|
+
require 'webmock/rspec'
|
11
|
+
|
12
|
+
SimpleCov.start
|
13
|
+
|
14
|
+
require 'influx_reporter'
|
15
|
+
|
16
|
+
module InfluxReporter
|
17
|
+
class Configuration
|
18
|
+
# Override defaults to enable http (caught by WebMock) in test env
|
19
|
+
defaults = DEFAULTS.dup.merge enabled_environments: %w[test]
|
20
|
+
remove_const(:DEFAULTS)
|
21
|
+
const_set(:DEFAULTS, defaults.freeze)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
RSpec.configure do |config|
|
26
|
+
config.backtrace_exclusion_patterns += [%r{/gems/}]
|
27
|
+
|
28
|
+
config.before :each do
|
29
|
+
@request_stub = stub_request(:post, /localhost:80/).to_return(status:204)
|
30
|
+
end
|
31
|
+
|
32
|
+
config.around :each, mock_time: true do |example|
|
33
|
+
@date = Time.utc(1992, 1, 1)
|
34
|
+
|
35
|
+
def travel(distance)
|
36
|
+
Timecop.freeze(@date += distance / 1_000.0)
|
37
|
+
end
|
38
|
+
|
39
|
+
travel 0
|
40
|
+
example.run
|
41
|
+
Timecop.return
|
42
|
+
end
|
43
|
+
|
44
|
+
def build_config(attrs = {})
|
45
|
+
InfluxReporter::Configuration.new({
|
46
|
+
influx_db: { time_precision: 'ns' }
|
47
|
+
}.merge(attrs))
|
48
|
+
end
|
49
|
+
|
50
|
+
config.around :each, start: true do |example|
|
51
|
+
InfluxReporter.start! build_config
|
52
|
+
example.call
|
53
|
+
InfluxReporter::Client.inst.current_transaction = nil
|
54
|
+
InfluxReporter.stop!
|
55
|
+
end
|
56
|
+
|
57
|
+
config.around :each, start_without_worker: true do |example|
|
58
|
+
InfluxReporter.start! build_config(disable_worker: true)
|
59
|
+
example.call
|
60
|
+
InfluxReporter::Client.inst.current_transaction = nil
|
61
|
+
InfluxReporter.stop!
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
RSpec::Matchers.define :delegate do |method, opts|
|
66
|
+
to = opts[:to]
|
67
|
+
args = opts[:args]
|
68
|
+
|
69
|
+
match do |delegator|
|
70
|
+
unless to.respond_to?(method)
|
71
|
+
raise NoMethodError, "no method :#{method} on #{to}"
|
72
|
+
end
|
73
|
+
|
74
|
+
if args
|
75
|
+
allow(to).to receive(method).with(*args) { true }
|
76
|
+
else
|
77
|
+
allow(to).to receive(method).with(no_args) { true }
|
78
|
+
end
|
79
|
+
|
80
|
+
delegator.send method, *args
|
81
|
+
end
|
82
|
+
|
83
|
+
description do
|
84
|
+
"delegate :#{method} to #{to}"
|
85
|
+
end
|
86
|
+
end
|
metadata
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: influx_reporter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kacper Kawecki
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: influxdb
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.5.3
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.5.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop
|
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
|
+
description:
|
56
|
+
email: kacper@geniebelt.com
|
57
|
+
executables: []
|
58
|
+
extensions: []
|
59
|
+
extra_rdoc_files:
|
60
|
+
- README.md
|
61
|
+
- LICENSE
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- ".rubocop.yml"
|
66
|
+
- ".travis.yml"
|
67
|
+
- ".yardopts"
|
68
|
+
- Dockerfile
|
69
|
+
- Gemfile
|
70
|
+
- HISTORY.md
|
71
|
+
- LICENSE
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- gemfiles/Gemfile.base
|
75
|
+
- gemfiles/Gemfile.rails-3.2.x
|
76
|
+
- gemfiles/Gemfile.rails-4.0.x
|
77
|
+
- gemfiles/Gemfile.rails-4.1.x
|
78
|
+
- gemfiles/Gemfile.rails-4.2.x
|
79
|
+
- gemfiles/Gemfile.rails-5.0.x
|
80
|
+
- gemfiles/Gemfile.rails-HEAD
|
81
|
+
- influx_reporter.gemspec
|
82
|
+
- lib/influx_reporter.rb
|
83
|
+
- lib/influx_reporter/client.rb
|
84
|
+
- lib/influx_reporter/configuration.rb
|
85
|
+
- lib/influx_reporter/data_builders.rb
|
86
|
+
- lib/influx_reporter/data_builders/error.rb
|
87
|
+
- lib/influx_reporter/data_builders/transactions.rb
|
88
|
+
- lib/influx_reporter/error.rb
|
89
|
+
- lib/influx_reporter/error_message.rb
|
90
|
+
- lib/influx_reporter/error_message/exception.rb
|
91
|
+
- lib/influx_reporter/error_message/http.rb
|
92
|
+
- lib/influx_reporter/error_message/stacktrace.rb
|
93
|
+
- lib/influx_reporter/error_message/user.rb
|
94
|
+
- lib/influx_reporter/filter.rb
|
95
|
+
- lib/influx_reporter/http_client.rb
|
96
|
+
- lib/influx_reporter/influx_db_client.rb
|
97
|
+
- lib/influx_reporter/injections.rb
|
98
|
+
- lib/influx_reporter/injections/json.rb
|
99
|
+
- lib/influx_reporter/injections/net_http.rb
|
100
|
+
- lib/influx_reporter/injections/redis.rb
|
101
|
+
- lib/influx_reporter/injections/sequel.rb
|
102
|
+
- lib/influx_reporter/injections/sinatra.rb
|
103
|
+
- lib/influx_reporter/integration/delayed_job.rb
|
104
|
+
- lib/influx_reporter/integration/rails/inject_exceptions_catcher.rb
|
105
|
+
- lib/influx_reporter/integration/railtie.rb
|
106
|
+
- lib/influx_reporter/integration/resque.rb
|
107
|
+
- lib/influx_reporter/integration/sidekiq.rb
|
108
|
+
- lib/influx_reporter/line_cache.rb
|
109
|
+
- lib/influx_reporter/logging.rb
|
110
|
+
- lib/influx_reporter/middleware.rb
|
111
|
+
- lib/influx_reporter/normalizers.rb
|
112
|
+
- lib/influx_reporter/normalizers/action_controller.rb
|
113
|
+
- lib/influx_reporter/normalizers/action_view.rb
|
114
|
+
- lib/influx_reporter/normalizers/active_record.rb
|
115
|
+
- lib/influx_reporter/sql_summarizer.rb
|
116
|
+
- lib/influx_reporter/subscriber.rb
|
117
|
+
- lib/influx_reporter/tasks.rb
|
118
|
+
- lib/influx_reporter/trace.rb
|
119
|
+
- lib/influx_reporter/trace_helpers.rb
|
120
|
+
- lib/influx_reporter/transaction.rb
|
121
|
+
- lib/influx_reporter/util.rb
|
122
|
+
- lib/influx_reporter/util/constantize.rb
|
123
|
+
- lib/influx_reporter/util/inspector.rb
|
124
|
+
- lib/influx_reporter/util/timestamp.rb
|
125
|
+
- lib/influx_reporter/version.rb
|
126
|
+
- lib/influx_reporter/worker.rb
|
127
|
+
- spec/influx_reporter/client_spec.rb
|
128
|
+
- spec/influx_reporter/configuration_spec.rb
|
129
|
+
- spec/influx_reporter/data_builders/error_spec.rb
|
130
|
+
- spec/influx_reporter/data_builders/transactions_spec.rb
|
131
|
+
- spec/influx_reporter/error_message/exception_spec.rb
|
132
|
+
- spec/influx_reporter/error_message/http_spec.rb
|
133
|
+
- spec/influx_reporter/error_message/stacktrace_spec.rb
|
134
|
+
- spec/influx_reporter/error_message/user_spec.rb
|
135
|
+
- spec/influx_reporter/error_message_spec.rb
|
136
|
+
- spec/influx_reporter/filter_spec.rb
|
137
|
+
- spec/influx_reporter/injections/net_http_spec.rb
|
138
|
+
- spec/influx_reporter/injections/sequel_spec.rb
|
139
|
+
- spec/influx_reporter/injections/sinatra_spec.rb
|
140
|
+
- spec/influx_reporter/injections_spec.rb
|
141
|
+
- spec/influx_reporter/integration/delayed_job_spec.rb
|
142
|
+
- spec/influx_reporter/integration/json_spec.rb
|
143
|
+
- spec/influx_reporter/integration/rails_spec.rb
|
144
|
+
- spec/influx_reporter/integration/redis_spec.rb
|
145
|
+
- spec/influx_reporter/integration/resque_spec.rb
|
146
|
+
- spec/influx_reporter/integration/sidekiq_spec.rb
|
147
|
+
- spec/influx_reporter/integration/sinatra_spec.rb
|
148
|
+
- spec/influx_reporter/line_cache_spec.rb
|
149
|
+
- spec/influx_reporter/logging_spec.rb
|
150
|
+
- spec/influx_reporter/middleware_spec.rb
|
151
|
+
- spec/influx_reporter/normalizers/action_controller_spec.rb
|
152
|
+
- spec/influx_reporter/normalizers/action_view_spec.rb
|
153
|
+
- spec/influx_reporter/normalizers/active_record_spec.rb
|
154
|
+
- spec/influx_reporter/normalizers_spec.rb
|
155
|
+
- spec/influx_reporter/sql_summarizer_spec.rb
|
156
|
+
- spec/influx_reporter/subscriber_spec.rb
|
157
|
+
- spec/influx_reporter/trace_spec.rb
|
158
|
+
- spec/influx_reporter/transaction_spec.rb
|
159
|
+
- spec/influx_reporter/util/inspector_spec.rb
|
160
|
+
- spec/influx_reporter/util_spec.rb
|
161
|
+
- spec/influx_reporter/worker_spec.rb
|
162
|
+
- spec/influx_reporter_spec.rb
|
163
|
+
- spec/spec_helper.rb
|
164
|
+
homepage: https://github.com/GenieBelt/influx-reporter
|
165
|
+
licenses:
|
166
|
+
- BSD-3-Clause
|
167
|
+
metadata: {}
|
168
|
+
post_install_message:
|
169
|
+
rdoc_options: []
|
170
|
+
require_paths:
|
171
|
+
- lib
|
172
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: 2.3.0
|
177
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
requirements: []
|
183
|
+
rubyforge_project:
|
184
|
+
rubygems_version: 2.5.2
|
185
|
+
signing_key:
|
186
|
+
specification_version: 4
|
187
|
+
summary: Metrics collector for rails and InfluxDB based on Opbeat Ruby client library
|
188
|
+
test_files: []
|