wildsight 0.1.19 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wildsight/agent/agent.rb +4 -4
- data/lib/wildsight/context/context.rb +21 -3
- data/lib/wildsight/context/logger.rb +1 -2
- data/lib/wildsight/rack/bottom_middleware.rb +1 -1
- data/lib/wildsight/rack/top_middleware.rb +4 -2
- data/lib/wildsight/rails/railtie.rb +1 -1
- data/lib/wildsight/version.rb +1 -1
- data/lib/wildsight_custom.rb +27 -0
- 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: 6ee42269fa992f53798cec753fcca9badb6fad51
|
4
|
+
data.tar.gz: 7f13c14c90891d7f58bb557e7a8187b8a23810a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 295b99bd465d01440b07add3deea6281707366171589b867e365fc0b30e288e0e8105a17c27700c669ba94ce6d33f47654abe203007d8284c29295af34e14297
|
7
|
+
data.tar.gz: 3a1563a2cea1d09fae697c808c1cba0c5e1ae11aa5d72b650793c7edecae346d0a4582f1dae70ffa06a06c141146379fe34f1a0817e4a258d7a6ac5061b170fb
|
@@ -51,8 +51,8 @@ module Wildsight
|
|
51
51
|
@contexts.delete(name)
|
52
52
|
end
|
53
53
|
|
54
|
-
def submit(event)
|
55
|
-
@events << event
|
54
|
+
def submit(type, event)
|
55
|
+
(@events[type] ||= []) << event
|
56
56
|
if @events.size > @config['agent']['threshold']
|
57
57
|
self.logger.log(:debug) { 'Uploading collected data' }
|
58
58
|
upload
|
@@ -60,7 +60,7 @@ module Wildsight
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def upload
|
63
|
-
payload, @events = @events,
|
63
|
+
payload, @events = @events, {}
|
64
64
|
@transport.send(payload) if payload != nil && payload.size > 0
|
65
65
|
end
|
66
66
|
|
@@ -70,7 +70,7 @@ module Wildsight
|
|
70
70
|
@logger = Wildsight::Agent::Logger.new(@config)
|
71
71
|
@logger.log(:debug) { 'Logger initialized' }
|
72
72
|
|
73
|
-
@events =
|
73
|
+
@events = {}
|
74
74
|
@contexts = {}
|
75
75
|
|
76
76
|
@transport = Wildsight::Transport.detect.new(self, @config)
|
@@ -33,9 +33,27 @@ module Wildsight
|
|
33
33
|
thread.thread_variable_set('wildsight.context', nil)
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
37
|
-
|
38
|
-
|
36
|
+
def event(series, data, occurred = DateTime.now, source = Wildsight.source, host = Wildsight.host)
|
37
|
+
@agent.submit(:events, {
|
38
|
+
host: host,
|
39
|
+
source: source,
|
40
|
+
series: series,
|
41
|
+
context: @name,
|
42
|
+
occurred: occurred,
|
43
|
+
data: data
|
44
|
+
})
|
45
|
+
end
|
46
|
+
|
47
|
+
def metric(series, value, data = {}, occurred = DateTime.now, source = Wildsight.source, host = Wildsight.host)
|
48
|
+
@agent.submit(:metrics, {
|
49
|
+
host: host,
|
50
|
+
source: source,
|
51
|
+
series: series,
|
52
|
+
context: @name,
|
53
|
+
occurred: occurred,
|
54
|
+
value: value,
|
55
|
+
data: data
|
56
|
+
})
|
39
57
|
end
|
40
58
|
|
41
59
|
def profiler
|
@@ -14,12 +14,11 @@ module Wildsight
|
|
14
14
|
def call(severity, time, progname, msg)
|
15
15
|
payload = {
|
16
16
|
:severity => severity,
|
17
|
-
:occurred => time,
|
18
17
|
:facility => progname,
|
19
18
|
:message => msg.to_s.strip
|
20
19
|
}
|
21
20
|
context = @context || Wildsight::Context.detect
|
22
|
-
context.
|
21
|
+
context.event(:log, payload) if context
|
23
22
|
return nil
|
24
23
|
end
|
25
24
|
|
@@ -50,9 +50,11 @@ module Wildsight
|
|
50
50
|
RESPONSE_EXCLUDE_KEYS.each { |key| context.data[:rack][:response][:headers].delete(key) }
|
51
51
|
end
|
52
52
|
|
53
|
-
|
53
|
+
context.event(:action_controller, context.data[:rack])
|
54
54
|
|
55
|
-
context.
|
55
|
+
context.profiler.data.keys.each do |key|
|
56
|
+
context.metric(key, context.profiler.data[key][:duration])
|
57
|
+
end
|
56
58
|
|
57
59
|
return response
|
58
60
|
ensure
|
data/lib/wildsight/version.rb
CHANGED
data/lib/wildsight_custom.rb
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
require 'wildsight/version'
|
2
2
|
|
3
|
+
require 'socket'
|
4
|
+
|
5
|
+
module Wildsight
|
6
|
+
|
7
|
+
def self.source=(value)
|
8
|
+
@source = value
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.source
|
12
|
+
@source ||= 'ruby'
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.host=(value)
|
16
|
+
@host = value
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.host
|
20
|
+
@host ||= Socket.gethostname
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
3
25
|
require 'wildsight/transport/transport'
|
4
26
|
require 'wildsight/metrics/metrics'
|
5
27
|
require 'wildsight/profiler/profiler'
|
@@ -7,13 +29,18 @@ require 'wildsight/context/context'
|
|
7
29
|
require 'wildsight/context/logger'
|
8
30
|
require 'wildsight/agent/agent'
|
9
31
|
|
32
|
+
|
10
33
|
if defined?(Rack)
|
34
|
+
Wildsight.source = 'rack'
|
35
|
+
|
11
36
|
require 'wildsight/rack/rack'
|
12
37
|
require 'wildsight/rack/top_middleware'
|
13
38
|
require 'wildsight/rack/bottom_middleware'
|
14
39
|
end
|
15
40
|
|
16
41
|
if defined?(Rails)
|
42
|
+
Wildsight.source = 'rails'
|
43
|
+
|
17
44
|
require 'wildsight/rails/action_controller'
|
18
45
|
require 'wildsight/rails/active_record'
|
19
46
|
require 'wildsight/rails/railtie'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wildsight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marek Jelen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-07-
|
12
|
+
date: 2016-07-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|