sqreen 1.1.51482852304 → 1.2.01484936161
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/lib/sqreen.rb +1 -0
- data/lib/sqreen/frameworks/generic.rb +9 -2
- data/lib/sqreen/remote_command.rb +1 -0
- data/lib/sqreen/runner.rb +9 -3
- data/lib/sqreen/sdk.rb +3 -0
- data/lib/sqreen/session.rb +1 -1
- data/lib/sqreen/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8b8e4c339703d78d76d87c9c00306ee5d658331
|
4
|
+
data.tar.gz: fbe298fb99b526c9b1a8366347ce90b830529412
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6567012ee61a57b061758f1f680443c1a1808ab9a63f253ddbb4f58e33172462e1bb3c02d6741ee30c4d357508c24994916b97ab78191a06fde8ecb789623ecf
|
7
|
+
data.tar.gz: 70f865c6df795c027b1c4225982904ae48b5b71cd94099cb066e80d7cd3d56277b5356b59dddbcb7d7649c2f6b66daacd6018929204809a37271635ec0184675
|
data/lib/sqreen.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Copyright (c) 2015 Sqreen. All Rights Reserved.
|
2
2
|
# Please refer to our terms for more information: https://www.sqreen.io/terms.html
|
3
|
+
require 'ipaddr'
|
3
4
|
|
4
5
|
require 'sqreen/events/remote_exception'
|
5
6
|
require 'sqreen/callbacks'
|
@@ -20,7 +21,6 @@ module Sqreen
|
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
23
|
-
|
24
24
|
# What kind of database is this
|
25
25
|
def db_settings(_options = {})
|
26
26
|
raise Sqreen::NotImplementedYet
|
@@ -67,7 +67,7 @@ module Sqreen
|
|
67
67
|
return nil unless req
|
68
68
|
forwarded = req.env['HTTP_X_FORWARDED_FOR']
|
69
69
|
ips = split_ip_addresses(forwarded)
|
70
|
-
last = ips.
|
70
|
+
last = ips.find { |ip| (ip !~ TRUSTED_PROXIES) && valid_ip?(ip) }
|
71
71
|
return last unless last.nil?
|
72
72
|
req.env['REMOTE_ADDR']
|
73
73
|
end
|
@@ -321,6 +321,13 @@ module Sqreen
|
|
321
321
|
def split_ip_addresses(ip_addresses)
|
322
322
|
ip_addresses ? ip_addresses.strip.split(/[,\s]+/) : []
|
323
323
|
end
|
324
|
+
|
325
|
+
def valid_ip?(ip)
|
326
|
+
IPAddr.new(ip)
|
327
|
+
true
|
328
|
+
rescue
|
329
|
+
false
|
330
|
+
end
|
324
331
|
end
|
325
332
|
end
|
326
333
|
end
|
data/lib/sqreen/runner.rb
CHANGED
@@ -62,6 +62,7 @@ module Sqreen
|
|
62
62
|
attr_reader :deliverer
|
63
63
|
attr_reader :session
|
64
64
|
attr_reader :instrumenter
|
65
|
+
attr_accessor :running
|
65
66
|
attr_accessor :next_command_results
|
66
67
|
attr_accessor :next_metrics
|
67
68
|
|
@@ -76,6 +77,7 @@ module Sqreen
|
|
76
77
|
@last_heartbeat_request = Time.now
|
77
78
|
@next_command_results = {}
|
78
79
|
@next_metrics = []
|
80
|
+
@running = true
|
79
81
|
|
80
82
|
@token = @configuration.get(:token)
|
81
83
|
@url = @configuration.get(:url)
|
@@ -285,9 +287,7 @@ module Sqreen
|
|
285
287
|
end
|
286
288
|
|
287
289
|
def run_watcher
|
288
|
-
|
289
|
-
run_watcher_once
|
290
|
-
end
|
290
|
+
run_watcher_once while running
|
291
291
|
end
|
292
292
|
|
293
293
|
# Sinatra is using at_exit to run the application, see:
|
@@ -298,6 +298,11 @@ module Sqreen
|
|
298
298
|
!Sinatra::Application.run?
|
299
299
|
end
|
300
300
|
|
301
|
+
def shutdown(_context_infos={})
|
302
|
+
remove_instrumentation
|
303
|
+
logout
|
304
|
+
end
|
305
|
+
|
301
306
|
def logout(retrying = true)
|
302
307
|
return unless session
|
303
308
|
if @logged_out_tried
|
@@ -309,6 +314,7 @@ module Sqreen
|
|
309
314
|
aggregate_observations
|
310
315
|
session.post_metrics(metrics_engine.publish) if metrics_engine
|
311
316
|
session.logout(retrying)
|
317
|
+
@running = false
|
312
318
|
end
|
313
319
|
|
314
320
|
def register_exit_cb(try_again = true)
|
data/lib/sqreen/sdk.rb
CHANGED
data/lib/sqreen/session.rb
CHANGED
data/lib/sqreen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqreen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.01484936161
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sqreen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|