dry-monitor 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e21a185d78c3e50cd1c99ddf4d211ed3650b298f
4
+ data.tar.gz: e103e5a459c69901f96423978e55fdf325f85f54
5
+ SHA512:
6
+ metadata.gz: 7539abd470e9413b7882ff41f0674f2fc3bfcf860c394e4e53991611316a636f2ba76cea514d2f6178ede7677ae6b782b3844e44f806d95f6719cc906beb38b8
7
+ data.tar.gz: 8d97ebaba61a89e895669d1ecfa88266fe596f44c92590bffa68a5acf4dc5dcdc1fc8ff03f24f65d1966d06b38c9cb1ba28b6aa04e5ad58926304b868ca7d565
@@ -0,0 +1,9 @@
1
+ .DS_Store
2
+ coverage
3
+ /.bundle
4
+ vendor/bundle
5
+ bin/
6
+ tmp/
7
+ .idea/
8
+ Gemfile.lock
9
+ spec/test_logs/*.log
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --order random
@@ -0,0 +1,16 @@
1
+ # Generated by `rubocop --auto-gen-config`
2
+ inherit_from: .rubocop_todo.yml
3
+
4
+ Metrics/LineLength:
5
+ Max: 100
6
+
7
+ Style/Documentation:
8
+ Enabled: false
9
+
10
+ Lint/HandleExceptions:
11
+ Exclude:
12
+ - rakelib/*.rake
13
+
14
+ Style/FileName:
15
+ Exclude:
16
+ - lib/dry-logic.rb
@@ -0,0 +1,7 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2015-10-30 01:32:46 +0000 using RuboCop version 0.34.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
@@ -0,0 +1,25 @@
1
+ language: ruby
2
+ dist: trusty
3
+ sudo: required
4
+ cache: bundler
5
+ bundler_args: --without sql benchmarks console tools
6
+ script: "bundle exec rake ci"
7
+ after_success:
8
+ - '[ "${TRAVIS_JOB_NUMBER#*.}" = "1" ] && [ "$TRAVIS_BRANCH" = "master" ] && bundle exec codeclimate-test-reporter'
9
+ rvm:
10
+ - 2.4.0
11
+ - 2.3
12
+ - 2.2
13
+ - rbx-3
14
+ - jruby
15
+ env:
16
+ global:
17
+ - JRUBY_OPTS='--dev -J-Xmx1024M'
18
+ - COVERAGE='true'
19
+ notifications:
20
+ webhooks:
21
+ urls:
22
+ - https://webhooks.gitter.im/e/19098b4253a72c9796db
23
+ on_success: change
24
+ on_failure: always
25
+ on_start: false
@@ -0,0 +1,3 @@
1
+ # v0.0.1 2017-02-01
2
+
3
+ First public release
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem 'rack'
7
+ gem 'simplecov', platform: :mri, require: false
8
+ gem 'codeclimate-test-reporter', require: false
9
+ end
10
+
11
+ group :tools do
12
+ gem 'byebug', platform: :mri
13
+ end
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Ruby Object Mapper
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ [gem]: https://rubygems.org/gems/dry-monitor
2
+ [travis]: https://travis-ci.org/dry-rb/dry-monitor
3
+ [gemnasium]: https://gemnasium.com/dry-rb/dry-monitor
4
+ [codeclimate]: https://codeclimate.com/github/dry-rb/dry-monitor
5
+ [coveralls]: https://coveralls.io/r/dry-rb/dry-monitor
6
+ [inchpages]: http://inch-ci.org/github/dry-rb/dry-monitor
7
+
8
+ # dry-monitor [![Join the chat at https://gitter.im/dry-rb/chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dry-rb/chat)
9
+
10
+ [![Gem Version](https://badge.fury.io/rb/dry-monitor.svg)][gem]
11
+ [![Build Status](https://travis-ci.org/dry-rb/dry-monitor.svg?branch=master)][travis]
12
+ [![Dependency Status](https://gemnasium.com/dry-rb/dry-monitor.svg)][gemnasium]
13
+ [![Code Climate](https://codeclimate.com/github/dry-rb/dry-monitor/badges/gpa.svg)][codeclimate]
14
+ [![Test Coverage](https://codeclimate.com/github/dry-rb/dry-monitor/badges/coverage.svg)][codeclimate]
15
+ [![Inline docs](http://inch-ci.org/github/dry-rb/dry-monitor.svg?branch=master)][inchpages]
16
+
17
+ Monitoring and instrumentation APIs.
18
+
19
+ ## Synopsis
20
+
21
+ ``` ruby
22
+ ```
23
+
24
+ ## License
25
+
26
+ See `LICENSE` file.
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
3
+
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
5
+
6
+ require 'rspec/core'
7
+ require 'rspec/core/rake_task'
8
+
9
+ task default: :spec
10
+
11
+ desc 'Run all specs in spec directory'
12
+ RSpec::Core::RakeTask.new(:spec)
13
+
14
+ desc "Run CI tasks"
15
+ task ci: [:spec]
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ require File.expand_path('../lib/dry/monitor/version', __FILE__)
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = 'dry-monitor'
6
+ spec.version = Dry::Monitor::VERSION
7
+ spec.authors = ['Piotr Solnica']
8
+ spec.email = ['piotr.solnica@gmail.com']
9
+ spec.summary = 'Monitoring and instrumentation APIs'
10
+ spec.homepage = 'https://github.com/dry-rb/dry-monitor'
11
+ spec.license = 'MIT'
12
+
13
+ spec.files = `git ls-files -z`.split("\x0")
14
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.require_paths = ['lib']
17
+
18
+ spec.add_runtime_dependency 'rouge', '~> 2.0'
19
+ spec.add_runtime_dependency 'dry-equalizer', '~> 0.2'
20
+ spec.add_runtime_dependency 'dry-configurable', '~> 0.5'
21
+
22
+ spec.add_development_dependency 'bundler'
23
+ spec.add_development_dependency 'rake'
24
+ spec.add_development_dependency 'rspec'
25
+ end
@@ -0,0 +1 @@
1
+ require 'dry/monitor'
@@ -0,0 +1,85 @@
1
+ require 'dry-equalizer'
2
+
3
+ require 'dry/monitor/rack/middleware'
4
+ require 'dry/monitor/logger'
5
+ require 'dry/monitor/sql/logger'
6
+
7
+ module Dry
8
+ module Monitor
9
+ class Clock
10
+ def measure(&block)
11
+ start = current
12
+ result = block.()
13
+ stop = current
14
+ [result, ((stop - start) * 1000).round(2)]
15
+ end
16
+
17
+ def current
18
+ Time.now
19
+ end
20
+ end
21
+
22
+ CLOCK = Clock.new
23
+
24
+ class Event
25
+ attr_reader :id
26
+
27
+ attr_reader :info
28
+
29
+ def initialize(id, info = {})
30
+ @id = id
31
+ @info = info
32
+ end
33
+ end
34
+
35
+ class Notifications
36
+ attr_reader :id
37
+ attr_reader :events
38
+ attr_reader :listeners
39
+ attr_reader :clock
40
+
41
+ def initialize(id)
42
+ @id = id
43
+ @listeners = Hash.new { |h, k| h[k] = [] }
44
+ @events = {}
45
+ @clock = CLOCK
46
+ end
47
+
48
+ def event(id, info = {})
49
+ events[id] = Event.new(id, info)
50
+ self
51
+ end
52
+
53
+ def subscribe(event_id, listener = nil, &block)
54
+ listeners[event_id] << (listener || block)
55
+ self
56
+ end
57
+
58
+ def start(event_id, payload)
59
+ instrument(event_id, payload)
60
+ end
61
+
62
+ def stop(event_id, payload)
63
+ instrument(event_id, payload)
64
+ end
65
+
66
+ def instrument(event_id, payload = nil, &block)
67
+ event = events[event_id]
68
+
69
+ if block
70
+ result, time = clock.measure(&block)
71
+ end
72
+
73
+ listeners[event_id].each do |listener|
74
+ if time
75
+ listener.(time, event.id, payload.merge(event.info))
76
+ else
77
+ listener.(event.id, payload.merge(event.info))
78
+ end
79
+ end
80
+
81
+ result
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,14 @@
1
+ require 'logger'
2
+
3
+ module Dry
4
+ module Monitor
5
+ class Logger < ::Logger
6
+ def initialize(*args)
7
+ super
8
+ self.formatter = proc do |severity, datetime, progname, msg|
9
+ "#{msg}\n"
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,138 @@
1
+ require 'dry/configurable'
2
+ require 'rack/utils'
3
+
4
+ module Dry
5
+ module Monitor
6
+ module Rack
7
+ class Logger
8
+ extend Dry::Configurable
9
+
10
+ setting :filtered_params, %w[_csrf password]
11
+
12
+ REQUEST_METHOD = 'REQUEST_METHOD'.freeze
13
+ PATH_INFO = 'PATH_INFO'.freeze
14
+ REMOTE_ADDR = 'REMOTE_ADDR'.freeze
15
+ RACK_INPUT = 'rack.input'.freeze
16
+ QUERY_PARAMS = 'QUERY_PARAMS'.freeze
17
+
18
+ START_MSG = %(Started %s "%s" for %s at %s).freeze
19
+ STOP_MSG = %(Finished %s "%s" for %s in %sms [Status: %s]).freeze
20
+ PARAMS_MSG = %( Parameters %s).freeze
21
+ QUERY_MSG = %( Query parameters %s).freeze
22
+ FILTERED = '[FILTERED]'.freeze
23
+
24
+ attr_reader :logger
25
+
26
+ attr_reader :config
27
+
28
+ def initialize(logger, config = self.class.config)
29
+ @logger = logger
30
+ @config = config
31
+ end
32
+
33
+ def subscribe(notifications)
34
+ notifications.subscribe(Middleware::REQUEST_START) do |id, payload|
35
+ log_start_request(payload[:env])
36
+ end
37
+
38
+ notifications.subscribe(Middleware::REQUEST_STOP) do |id, payload|
39
+ log_stop_request(payload[:env], payload[:status], payload[:time])
40
+ end
41
+
42
+ notifications.subscribe(Middleware::APP_ERROR) do |id, payload|
43
+ log_exception(payload[:exception], payload[:name])
44
+ end
45
+ end
46
+
47
+ def log_exception(e, app_name)
48
+ logger.error e.message
49
+ logger.error filter_backtrace(e.backtrace, app_name).join("\n")
50
+ end
51
+
52
+ def log_start_request(request)
53
+ info START_MSG % [
54
+ request[REQUEST_METHOD],
55
+ request[PATH_INFO],
56
+ request[REMOTE_ADDR],
57
+ Time.now
58
+ ]
59
+ log_request_params(request)
60
+ end
61
+
62
+ def log_stop_request(request, status, time)
63
+ info STOP_MSG % [
64
+ request[REQUEST_METHOD],
65
+ request[PATH_INFO],
66
+ request[REMOTE_ADDR],
67
+ time,
68
+ status
69
+ ]
70
+ end
71
+
72
+ def log_request_params(request)
73
+ with_http_params(request[QUERY_PARAMS]) do |params|
74
+ info QUERY_MSG % [params.inspect]
75
+ end
76
+ end
77
+
78
+ def info(*args)
79
+ logger.info(*args)
80
+ end
81
+
82
+ def with_http_params(params)
83
+ params = ::Rack::Utils.parse_nested_query(params)
84
+ if params.size > 0
85
+ yield(filter_params(params))
86
+ end
87
+ end
88
+
89
+ def filter_backtrace(backtrace, app_name)
90
+ # TODO: what do we want to do with this?
91
+ backtrace.reject { |l| l.include?('gems') }
92
+ end
93
+
94
+ def filter_params(params)
95
+ params.each_with_object({}) do |(k, v), h|
96
+ if v.is_a?(Hash)
97
+ h.update(k => filter_params(v))
98
+ elsif v.is_a?(Array)
99
+ h.update(k => v.map { |m| filter_params(m) })
100
+ elsif config.filtered_params.include?(k)
101
+ h.update(k => FILTERED)
102
+ else
103
+ h[k] = v
104
+ end
105
+ end
106
+ end
107
+ end
108
+
109
+ class Middleware
110
+ REQUEST_START = :'request.start'
111
+ REQUEST_STOP = :'request.stop'
112
+ APP_ERROR = :'app.error'
113
+
114
+ attr_reader :app
115
+ attr_reader :notifications
116
+
117
+ def initialize(*args)
118
+ @notifications, @app = *args
119
+
120
+ notifications.event(REQUEST_START)
121
+ notifications.event(REQUEST_STOP)
122
+ notifications.event(APP_ERROR)
123
+ end
124
+
125
+ def new(app)
126
+ self.class.new(notifications, app)
127
+ end
128
+
129
+ def call(env)
130
+ notifications.start(REQUEST_START, env: env)
131
+ response, time = CLOCK.measure { app.call(env) }
132
+ notifications.stop(REQUEST_STOP, env: env, time: time, status: response[0])
133
+ response
134
+ end
135
+ end
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,43 @@
1
+ require 'dry-configurable'
2
+ require 'rouge'
3
+
4
+ module Dry
5
+ module Monitor
6
+ module SQL
7
+ class Logger
8
+ extend Dry::Configurable
9
+
10
+ setting :theme, Rouge::Themes::Gruvbox
11
+ setting :colorize, true
12
+
13
+ attr_reader :config
14
+ attr_reader :logger
15
+ attr_reader :formatter
16
+ attr_reader :lexer
17
+
18
+ def initialize(logger, config = self.class.config)
19
+ @logger = logger
20
+ @config = config
21
+ @formatter = Rouge::Formatters::Terminal256.new(config.theme)
22
+ @lexer = Rouge::Lexers::SQL.new
23
+ end
24
+
25
+ def subscribe(notifications)
26
+ notifications.event(:sql).subscribe(:sql) do |time, id, payload|
27
+ log_query(time, payload[:name], payload[:query])
28
+ end
29
+ end
30
+
31
+ def log_query(time, name, query)
32
+ logger.info " Loaded #{name.inspect} in #{time}ms #{colorize(query)}"
33
+ end
34
+
35
+ private
36
+
37
+ def colorize(string)
38
+ config.colorize ? formatter.format(lexer.lex(string)) : string
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,5 @@
1
+ module Dry
2
+ module Monitor
3
+ VERSION = '0.0.1'.freeze
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ begin
2
+ require 'rubocop/rake_task'
3
+
4
+ Rake::Task[:default].enhance [:rubocop]
5
+
6
+ RuboCop::RakeTask.new do |task|
7
+ task.options << '--display-cop-names'
8
+ end
9
+
10
+ namespace :rubocop do
11
+ desc 'Generate a configuration file acting as a TODO list.'
12
+ task :auto_gen_config do
13
+ exec 'bundle exec rubocop --auto-gen-config'
14
+ end
15
+ end
16
+
17
+ rescue LoadError
18
+ end
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe 'Subscribing to instrumentation events' do
4
+ subject(:notifications) { Dry::Monitor::Notifications.new(:app) }
5
+
6
+ describe '#instrument' do
7
+ it 'allows subscribing listeners to specific events' do
8
+ payload = { query: 'SELECT 1 FROM users' }
9
+ captured = []
10
+ listener = -> id, payload { captured << [id, payload] }
11
+
12
+ notifications.event(:sql, { name: 'rom[sql]' }).subscribe(:sql, listener)
13
+
14
+ notifications.instrument(:sql, payload)
15
+
16
+ expect(captured).to eql([[:sql, { name: 'rom[sql]', query: 'SELECT 1 FROM users'}]])
17
+ end
18
+
19
+ it 'allows subscribing via block' do
20
+ captured = []
21
+ payload = { query: 'SELECT 1 FROM users' }
22
+
23
+ notifications.event(:sql, { name: 'rom[sql]' }).subscribe(:sql) do |id, payload|
24
+ captured << [id, payload]
25
+ end
26
+
27
+ notifications.instrument(:sql, payload)
28
+
29
+ expect(captured).to eql([[:sql, { name: 'rom[sql]', query: 'SELECT 1 FROM users'}]])
30
+ end
31
+
32
+ it 'allows instrumenting via block' do
33
+ captured = []
34
+ payload = { query: 'SELECT 1 FROM users' }
35
+
36
+ notifications.event(:sql, { name: 'rom[sql]' }).subscribe(:sql) do |time, id, payload|
37
+ captured << [id, payload]
38
+ end
39
+
40
+ notifications.instrument(:sql, payload) do
41
+ payload
42
+ end
43
+
44
+ expect(captured).to eql([[:sql, { name: 'rom[sql]', query: 'SELECT 1 FROM users'}]])
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Dry::Monitor::Logger do
4
+ subject(:logger) do
5
+ Dry::Monitor::Logger.new($stdout)
6
+ end
7
+
8
+ describe '#info' do
9
+ it 'outputs with configured formatter' do
10
+ expect { logger.info('test') }.to output("test\n").to_stdout
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Dry::Monitor::Rack::Middleware do
4
+ subject(:middleware) { Dry::Monitor::Rack::Middleware.new(notifications).new(rack_app) }
5
+
6
+ let(:notifications) do
7
+ Dry::Monitor::Notifications.new(:test)
8
+ end
9
+
10
+ let(:rack_app) do
11
+ double(:rack_app)
12
+ end
13
+
14
+ let(:log_file_path) do
15
+ SPEC_ROOT.join('test_logs/middleware.log')
16
+ end
17
+
18
+ let(:rack_logger) do
19
+ Dry::Monitor::Rack::Logger.new(Dry::Monitor::Logger.new(log_file_path))
20
+ end
21
+
22
+ describe '#call' do
23
+ let(:env) do
24
+ { 'REQUEST_METHOD' => 'GET', 'PATH_INFO' => '/hello-world', 'REMOTE_ADDR' => '0.0.0.0', 'QUERY_PARAMS' => query_params }
25
+ end
26
+
27
+ let(:query_params) do
28
+ '_csrf=123456&password=secret&user[password]=secret&other[][password]=secret&other[][password]=secret&foo=bar&one=1'
29
+ end
30
+
31
+ before do
32
+ File.open(log_file_path, 'w').close
33
+ rack_logger.subscribe(notifications)
34
+ end
35
+
36
+ it 'triggers start/stop events for with a rack request' do
37
+ expect(rack_app).to receive(:call).with(env).and_return([200, :total_success])
38
+
39
+ status, response = middleware.call(env)
40
+
41
+ expect(status).to be(200)
42
+ expect(response).to be(:total_success)
43
+
44
+ log_file_content = File.read(log_file_path)
45
+
46
+ expect(log_file_content).to include('Started GET "/hello-world"')
47
+ expect(log_file_content).to include('Finished GET "/hello-world"')
48
+ expect(log_file_content).to include('Query parameters {"_csrf"=>"[FILTERED]", "password"=>"[FILTERED]", "user"=>{"password"=>"[FILTERED]"}, "other"=>[{"password"=>"[FILTERED]"}, {"password"=>"[FILTERED]"}], "foo"=>"bar", "one"=>"1"}')
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Dry::Monitor::SQL::Logger do
4
+ subject(:logger) { sql_logger.new(Dry::Monitor::Logger.new(log_file_path)) }
5
+
6
+ let(:notifications) do
7
+ Dry::Monitor::Notifications.new(:test)
8
+ end
9
+
10
+ let(:log_file_path) do
11
+ SPEC_ROOT.join('test_logs/sql.log')
12
+ end
13
+
14
+ let(:log_file_content) { File.read(log_file_path) }
15
+
16
+ shared_context '#subscribe' do
17
+ let(:query) do
18
+ 'SELECT id, name FROM users'
19
+ end
20
+
21
+ before do
22
+ File.open(log_file_path, 'w').close
23
+
24
+ logger.subscribe(notifications)
25
+
26
+ notifications.instrument(:sql, name: 'users', query: query) do
27
+ sleep 0.0025
28
+ end
29
+ end
30
+
31
+ it 'writes sql query info' do
32
+ expect(log_file_content).to include('Loaded "users" in')
33
+ end
34
+ end
35
+
36
+ context 'without colors' do
37
+ let(:sql_logger) do
38
+ Class.new(Dry::Monitor::SQL::Logger) do
39
+ configure do |config|
40
+ config.colorize = false
41
+ end
42
+ end
43
+ end
44
+
45
+ include_context '#subscribe' do
46
+ it 'writes sql query in logs' do
47
+ expect(log_file_content).to include(query)
48
+ end
49
+ end
50
+ end
51
+
52
+ context 'without colors' do
53
+ let(:sql_logger) do
54
+ Dry::Monitor::SQL::Logger
55
+ end
56
+
57
+ include_context '#subscribe'
58
+ end
59
+ end
@@ -0,0 +1,21 @@
1
+ if RUBY_ENGINE == 'ruby' && ENV['CI'] == 'true'
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ add_filter '/spec/'
5
+ end
6
+ end
7
+
8
+ begin
9
+ require 'byebug'
10
+ rescue LoadError; end
11
+
12
+ require 'dry-monitor'
13
+
14
+ SPEC_ROOT = Pathname(__dir__)
15
+
16
+ Dir[SPEC_ROOT.join('shared/**/*.rb')].each(&method(:require))
17
+ Dir[SPEC_ROOT.join('support/**/*.rb')].each(&method(:require))
18
+
19
+ RSpec.configure do |config|
20
+ config.disable_monkey_patching!
21
+ end
File without changes
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dry-monitor
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Piotr Solnica
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-02-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rouge
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: dry-equalizer
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: dry-configurable
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.5'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
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: rake
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: rspec
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
+ description:
98
+ email:
99
+ - piotr.solnica@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".rubocop.yml"
107
+ - ".rubocop_todo.yml"
108
+ - ".travis.yml"
109
+ - CHANGELOG.md
110
+ - Gemfile
111
+ - LICENSE
112
+ - README.md
113
+ - Rakefile
114
+ - dry-monitor.gemspec
115
+ - lib/dry-monitor.rb
116
+ - lib/dry/monitor.rb
117
+ - lib/dry/monitor/logger.rb
118
+ - lib/dry/monitor/rack/middleware.rb
119
+ - lib/dry/monitor/sql/logger.rb
120
+ - lib/dry/monitor/version.rb
121
+ - rakelib/rubocop.rake
122
+ - spec/integration/instrumentation_spec.rb
123
+ - spec/integration/logger_spec.rb
124
+ - spec/integration/rack_middleware_spec.rb
125
+ - spec/integration/sql_logger_spec.rb
126
+ - spec/spec_helper.rb
127
+ - spec/test_logs/.gitkeep
128
+ homepage: https://github.com/dry-rb/dry-monitor
129
+ licenses:
130
+ - MIT
131
+ metadata: {}
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 2.6.9
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Monitoring and instrumentation APIs
152
+ test_files:
153
+ - spec/integration/instrumentation_spec.rb
154
+ - spec/integration/logger_spec.rb
155
+ - spec/integration/rack_middleware_spec.rb
156
+ - spec/integration/sql_logger_spec.rb
157
+ - spec/spec_helper.rb
158
+ - spec/test_logs/.gitkeep