skylight 0.0.16 → 0.1.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +3 -19
- data/bin/skylight +0 -2
- data/lib/skylight.rb +52 -42
- data/lib/skylight/api.rb +34 -0
- data/lib/skylight/cli.rb +68 -57
- data/lib/skylight/compat.rb +19 -5
- data/lib/skylight/config.rb +219 -98
- data/lib/skylight/gc.rb +109 -0
- data/lib/skylight/instrumenter.rb +53 -70
- data/lib/skylight/messages.rb +19 -0
- data/lib/skylight/messages/annotation.rb +13 -0
- data/lib/skylight/messages/base.rb +24 -0
- data/lib/skylight/messages/batch.rb +11 -0
- data/lib/skylight/messages/endpoint.rb +12 -0
- data/lib/skylight/messages/event.rb +12 -0
- data/lib/skylight/messages/hello.rb +53 -0
- data/lib/skylight/messages/span.rb +21 -0
- data/lib/skylight/messages/trace.rb +162 -0
- data/lib/skylight/middleware.rb +2 -4
- data/lib/skylight/normalizers.rb +89 -0
- data/lib/skylight/normalizers/default.rb +22 -0
- data/lib/skylight/normalizers/process_action.rb +19 -0
- data/lib/skylight/normalizers/render_collection.rb +14 -0
- data/lib/skylight/normalizers/render_partial.rb +14 -0
- data/lib/skylight/normalizers/render_template.rb +14 -0
- data/lib/skylight/{normalize → normalizers}/send_file.rb +15 -15
- data/lib/skylight/normalizers/sql.rb +25 -0
- data/lib/skylight/railtie.rb +21 -41
- data/lib/skylight/subscriber.rb +29 -19
- data/lib/skylight/util/clock.rb +8 -21
- data/lib/skylight/util/http.rb +93 -46
- data/lib/skylight/util/logging.rb +66 -0
- data/lib/skylight/util/queue.rb +7 -3
- data/lib/skylight/util/task.rb +154 -0
- data/lib/skylight/{compat → vendor/active_support}/notifications.rb +56 -24
- data/lib/skylight/{compat → vendor/active_support}/notifications/fanout.rb +19 -26
- data/lib/skylight/{compat → vendor/active_support}/notifications/instrumenter.rb +25 -18
- data/lib/skylight/vendor/active_support/per_thread_registry.rb +52 -0
- data/lib/skylight/vendor/beefcake.rb +256 -0
- data/lib/skylight/vendor/beefcake/buffer.rb +112 -0
- data/lib/skylight/vendor/beefcake/decode.rb +107 -0
- data/lib/skylight/vendor/beefcake/encode.rb +115 -0
- data/lib/skylight/vendor/{highline.rb → cli/highline.rb} +0 -0
- data/lib/skylight/vendor/{highline → cli/highline}/color_scheme.rb +0 -0
- data/lib/skylight/vendor/{highline → cli/highline}/compatibility.rb +0 -0
- data/lib/skylight/vendor/{highline → cli/highline}/import.rb +0 -0
- data/lib/skylight/vendor/{highline → cli/highline}/menu.rb +0 -0
- data/lib/skylight/vendor/{highline → cli/highline}/question.rb +0 -0
- data/lib/skylight/vendor/{highline → cli/highline}/simulate.rb +0 -0
- data/lib/skylight/vendor/{highline → cli/highline}/string_extensions.rb +0 -0
- data/lib/skylight/vendor/{highline → cli/highline}/style.rb +0 -0
- data/lib/skylight/vendor/{highline → cli/highline}/system_extensions.rb +0 -0
- data/lib/skylight/vendor/{thor.rb → cli/thor.rb} +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/actions.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/actions/create_file.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/actions/create_link.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/actions/directory.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/actions/empty_directory.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/actions/file_manipulation.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/actions/inject_into_file.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/base.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/command.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/core_ext/hash_with_indifferent_access.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/core_ext/io_binary_read.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/core_ext/ordered_hash.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/error.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/group.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/invocation.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/parser.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/parser/argument.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/parser/arguments.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/parser/option.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/parser/options.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/rake_compat.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/runner.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/shell.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/shell/basic.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/shell/color.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/shell/html.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/util.rb +0 -0
- data/lib/skylight/vendor/{thor → cli/thor}/version.rb +0 -0
- data/lib/skylight/vendor/thread_safe.rb +126 -0
- data/lib/skylight/vendor/thread_safe/non_concurrent_cache_backend.rb +133 -0
- data/lib/skylight/vendor/thread_safe/synchronized_cache_backend.rb +76 -0
- data/lib/skylight/version.rb +2 -1
- data/lib/skylight/worker.rb +12 -154
- data/lib/skylight/worker/builder.rb +72 -0
- data/lib/skylight/worker/collector.rb +124 -0
- data/lib/skylight/worker/connection.rb +77 -0
- data/lib/skylight/worker/embedded.rb +6 -0
- data/lib/skylight/worker/server.rb +307 -0
- data/lib/skylight/worker/standalone.rb +356 -0
- metadata +89 -77
- data/lib/skylight/connection.rb +0 -25
- data/lib/skylight/json_proto.rb +0 -88
- data/lib/skylight/normalize.rb +0 -63
- data/lib/skylight/normalize/default.rb +0 -17
- data/lib/skylight/normalize/process_action.rb +0 -17
- data/lib/skylight/normalize/render_collection.rb +0 -11
- data/lib/skylight/normalize/render_partial.rb +0 -14
- data/lib/skylight/normalize/render_template.rb +0 -13
- data/lib/skylight/normalize/sql.rb +0 -26
- data/lib/skylight/normalize/start_processing.rb +0 -12
- data/lib/skylight/sanity_checker.rb +0 -73
- data/lib/skylight/trace.rb +0 -160
- data/lib/skylight/util/atomic.rb +0 -73
- data/lib/skylight/util/bytes.rb +0 -40
- data/lib/skylight/util/ewma.rb +0 -32
- data/lib/skylight/util/uuid.rb +0 -33
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skylight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0.alpha1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Tilde, Inc.
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-05-24 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activesupport
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 3.0.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 3.0.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: actionpack
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 3.0.0
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 3.0.0
|
46
41
|
description: Currently in pre-alpha.
|
@@ -52,103 +47,120 @@ extensions: []
|
|
52
47
|
extra_rdoc_files: []
|
53
48
|
files:
|
54
49
|
- lib/skylight.rb
|
50
|
+
- lib/skylight/api.rb
|
55
51
|
- lib/skylight/cli.rb
|
56
52
|
- lib/skylight/compat.rb
|
57
|
-
- lib/skylight/compat/notifications.rb
|
58
|
-
- lib/skylight/compat/notifications/fanout.rb
|
59
|
-
- lib/skylight/compat/notifications/instrumenter.rb
|
60
53
|
- lib/skylight/config.rb
|
61
|
-
- lib/skylight/
|
54
|
+
- lib/skylight/gc.rb
|
62
55
|
- lib/skylight/instrumenter.rb
|
63
|
-
- lib/skylight/
|
56
|
+
- lib/skylight/messages.rb
|
57
|
+
- lib/skylight/messages/annotation.rb
|
58
|
+
- lib/skylight/messages/base.rb
|
59
|
+
- lib/skylight/messages/batch.rb
|
60
|
+
- lib/skylight/messages/endpoint.rb
|
61
|
+
- lib/skylight/messages/event.rb
|
62
|
+
- lib/skylight/messages/hello.rb
|
63
|
+
- lib/skylight/messages/span.rb
|
64
|
+
- lib/skylight/messages/trace.rb
|
64
65
|
- lib/skylight/middleware.rb
|
65
|
-
- lib/skylight/
|
66
|
-
- lib/skylight/
|
67
|
-
- lib/skylight/
|
68
|
-
- lib/skylight/
|
69
|
-
- lib/skylight/
|
70
|
-
- lib/skylight/
|
71
|
-
- lib/skylight/
|
72
|
-
- lib/skylight/
|
73
|
-
- lib/skylight/normalize/start_processing.rb
|
66
|
+
- lib/skylight/normalizers.rb
|
67
|
+
- lib/skylight/normalizers/default.rb
|
68
|
+
- lib/skylight/normalizers/process_action.rb
|
69
|
+
- lib/skylight/normalizers/render_collection.rb
|
70
|
+
- lib/skylight/normalizers/render_partial.rb
|
71
|
+
- lib/skylight/normalizers/render_template.rb
|
72
|
+
- lib/skylight/normalizers/send_file.rb
|
73
|
+
- lib/skylight/normalizers/sql.rb
|
74
74
|
- lib/skylight/railtie.rb
|
75
|
-
- lib/skylight/sanity_checker.rb
|
76
75
|
- lib/skylight/subscriber.rb
|
77
|
-
- lib/skylight/trace.rb
|
78
|
-
- lib/skylight/util/atomic.rb
|
79
|
-
- lib/skylight/util/bytes.rb
|
80
76
|
- lib/skylight/util/clock.rb
|
81
|
-
- lib/skylight/util/ewma.rb
|
82
77
|
- lib/skylight/util/gzip.rb
|
83
78
|
- lib/skylight/util/http.rb
|
79
|
+
- lib/skylight/util/logging.rb
|
84
80
|
- lib/skylight/util/queue.rb
|
81
|
+
- lib/skylight/util/task.rb
|
85
82
|
- lib/skylight/util/uniform_sample.rb
|
86
|
-
- lib/skylight/
|
87
|
-
- lib/skylight/vendor/
|
88
|
-
- lib/skylight/vendor/
|
89
|
-
- lib/skylight/vendor/
|
90
|
-
- lib/skylight/vendor/
|
91
|
-
- lib/skylight/vendor/
|
92
|
-
- lib/skylight/vendor/
|
93
|
-
- lib/skylight/vendor/
|
94
|
-
- lib/skylight/vendor/highline
|
95
|
-
- lib/skylight/vendor/highline/
|
96
|
-
- lib/skylight/vendor/highline/
|
97
|
-
- lib/skylight/vendor/
|
98
|
-
- lib/skylight/vendor/
|
99
|
-
- lib/skylight/vendor/
|
100
|
-
- lib/skylight/vendor/
|
101
|
-
- lib/skylight/vendor/
|
102
|
-
- lib/skylight/vendor/
|
103
|
-
- lib/skylight/vendor/
|
104
|
-
- lib/skylight/vendor/thor
|
105
|
-
- lib/skylight/vendor/thor/
|
106
|
-
- lib/skylight/vendor/thor/
|
107
|
-
- lib/skylight/vendor/thor/
|
108
|
-
- lib/skylight/vendor/thor/
|
109
|
-
- lib/skylight/vendor/thor/
|
110
|
-
- lib/skylight/vendor/thor/
|
111
|
-
- lib/skylight/vendor/thor/
|
112
|
-
- lib/skylight/vendor/thor/
|
113
|
-
- lib/skylight/vendor/thor/
|
114
|
-
- lib/skylight/vendor/thor/
|
115
|
-
- lib/skylight/vendor/thor/
|
116
|
-
- lib/skylight/vendor/thor/
|
117
|
-
- lib/skylight/vendor/thor/
|
118
|
-
- lib/skylight/vendor/thor/
|
119
|
-
- lib/skylight/vendor/thor/
|
120
|
-
- lib/skylight/vendor/thor/
|
121
|
-
- lib/skylight/vendor/thor/
|
122
|
-
- lib/skylight/vendor/thor/
|
123
|
-
- lib/skylight/vendor/thor/
|
124
|
-
- lib/skylight/vendor/thor/
|
125
|
-
- lib/skylight/vendor/thor/
|
83
|
+
- lib/skylight/vendor/active_support/notifications.rb
|
84
|
+
- lib/skylight/vendor/active_support/notifications/fanout.rb
|
85
|
+
- lib/skylight/vendor/active_support/notifications/instrumenter.rb
|
86
|
+
- lib/skylight/vendor/active_support/per_thread_registry.rb
|
87
|
+
- lib/skylight/vendor/beefcake.rb
|
88
|
+
- lib/skylight/vendor/beefcake/buffer.rb
|
89
|
+
- lib/skylight/vendor/beefcake/decode.rb
|
90
|
+
- lib/skylight/vendor/beefcake/encode.rb
|
91
|
+
- lib/skylight/vendor/cli/highline.rb
|
92
|
+
- lib/skylight/vendor/cli/highline/color_scheme.rb
|
93
|
+
- lib/skylight/vendor/cli/highline/compatibility.rb
|
94
|
+
- lib/skylight/vendor/cli/highline/import.rb
|
95
|
+
- lib/skylight/vendor/cli/highline/menu.rb
|
96
|
+
- lib/skylight/vendor/cli/highline/question.rb
|
97
|
+
- lib/skylight/vendor/cli/highline/simulate.rb
|
98
|
+
- lib/skylight/vendor/cli/highline/string_extensions.rb
|
99
|
+
- lib/skylight/vendor/cli/highline/style.rb
|
100
|
+
- lib/skylight/vendor/cli/highline/system_extensions.rb
|
101
|
+
- lib/skylight/vendor/cli/thor.rb
|
102
|
+
- lib/skylight/vendor/cli/thor/actions.rb
|
103
|
+
- lib/skylight/vendor/cli/thor/actions/create_file.rb
|
104
|
+
- lib/skylight/vendor/cli/thor/actions/create_link.rb
|
105
|
+
- lib/skylight/vendor/cli/thor/actions/directory.rb
|
106
|
+
- lib/skylight/vendor/cli/thor/actions/empty_directory.rb
|
107
|
+
- lib/skylight/vendor/cli/thor/actions/file_manipulation.rb
|
108
|
+
- lib/skylight/vendor/cli/thor/actions/inject_into_file.rb
|
109
|
+
- lib/skylight/vendor/cli/thor/base.rb
|
110
|
+
- lib/skylight/vendor/cli/thor/command.rb
|
111
|
+
- lib/skylight/vendor/cli/thor/core_ext/hash_with_indifferent_access.rb
|
112
|
+
- lib/skylight/vendor/cli/thor/core_ext/io_binary_read.rb
|
113
|
+
- lib/skylight/vendor/cli/thor/core_ext/ordered_hash.rb
|
114
|
+
- lib/skylight/vendor/cli/thor/error.rb
|
115
|
+
- lib/skylight/vendor/cli/thor/group.rb
|
116
|
+
- lib/skylight/vendor/cli/thor/invocation.rb
|
117
|
+
- lib/skylight/vendor/cli/thor/parser.rb
|
118
|
+
- lib/skylight/vendor/cli/thor/parser/argument.rb
|
119
|
+
- lib/skylight/vendor/cli/thor/parser/arguments.rb
|
120
|
+
- lib/skylight/vendor/cli/thor/parser/option.rb
|
121
|
+
- lib/skylight/vendor/cli/thor/parser/options.rb
|
122
|
+
- lib/skylight/vendor/cli/thor/rake_compat.rb
|
123
|
+
- lib/skylight/vendor/cli/thor/runner.rb
|
124
|
+
- lib/skylight/vendor/cli/thor/shell.rb
|
125
|
+
- lib/skylight/vendor/cli/thor/shell/basic.rb
|
126
|
+
- lib/skylight/vendor/cli/thor/shell/color.rb
|
127
|
+
- lib/skylight/vendor/cli/thor/shell/html.rb
|
128
|
+
- lib/skylight/vendor/cli/thor/util.rb
|
129
|
+
- lib/skylight/vendor/cli/thor/version.rb
|
130
|
+
- lib/skylight/vendor/thread_safe.rb
|
131
|
+
- lib/skylight/vendor/thread_safe/non_concurrent_cache_backend.rb
|
132
|
+
- lib/skylight/vendor/thread_safe/synchronized_cache_backend.rb
|
126
133
|
- lib/skylight/version.rb
|
127
134
|
- lib/skylight/worker.rb
|
135
|
+
- lib/skylight/worker/builder.rb
|
136
|
+
- lib/skylight/worker/collector.rb
|
137
|
+
- lib/skylight/worker/connection.rb
|
138
|
+
- lib/skylight/worker/embedded.rb
|
139
|
+
- lib/skylight/worker/server.rb
|
140
|
+
- lib/skylight/worker/standalone.rb
|
128
141
|
- README.md
|
129
142
|
- bin/skylight
|
130
143
|
homepage: http://www.skylight.io
|
131
144
|
licenses: []
|
145
|
+
metadata: {}
|
132
146
|
post_install_message:
|
133
147
|
rdoc_options: []
|
134
148
|
require_paths:
|
135
149
|
- lib
|
136
150
|
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
151
|
requirements:
|
139
|
-
- -
|
152
|
+
- - '>='
|
140
153
|
- !ruby/object:Gem::Version
|
141
154
|
version: 1.9.2
|
142
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
-
none: false
|
144
156
|
requirements:
|
145
|
-
- -
|
157
|
+
- - '>'
|
146
158
|
- !ruby/object:Gem::Version
|
147
|
-
version:
|
159
|
+
version: 1.3.1
|
148
160
|
requirements: []
|
149
161
|
rubyforge_project:
|
150
|
-
rubygems_version:
|
162
|
+
rubygems_version: 2.0.3
|
151
163
|
signing_key:
|
152
|
-
specification_version:
|
164
|
+
specification_version: 4
|
153
165
|
summary: Skylight is a ruby application monitoring tool.
|
154
166
|
test_files: []
|
data/lib/skylight/connection.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module Skylight
|
2
|
-
class Connection
|
3
|
-
|
4
|
-
def self.open(host, port, ssl)
|
5
|
-
conn = new(host, port, ssl)
|
6
|
-
conn.open
|
7
|
-
conn
|
8
|
-
end
|
9
|
-
|
10
|
-
def initialize(host, port, ssl)
|
11
|
-
@host = host
|
12
|
-
@port = port
|
13
|
-
@ssl = ssl
|
14
|
-
end
|
15
|
-
|
16
|
-
def open
|
17
|
-
# stuff
|
18
|
-
end
|
19
|
-
|
20
|
-
def close
|
21
|
-
# stuff
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
data/lib/skylight/json_proto.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
|
-
module Skylight
|
4
|
-
class JsonProto
|
5
|
-
def initialize(config)
|
6
|
-
@config = config
|
7
|
-
end
|
8
|
-
|
9
|
-
def write(out, from, counts, sample)
|
10
|
-
|
11
|
-
# {
|
12
|
-
# batch: {
|
13
|
-
# timestamp: 123456, // Second granularity
|
14
|
-
# endpoints: [
|
15
|
-
# {
|
16
|
-
# name: "WidgetsController#index",
|
17
|
-
# count: 100, // There can be a higher count # than there are traces
|
18
|
-
# traces: [
|
19
|
-
# {
|
20
|
-
# // Trace UUID
|
21
|
-
# uuid: "d11d7190-40cc-11e2-a25f-0800200c9a66",
|
22
|
-
# spans: [
|
23
|
-
# [
|
24
|
-
# null, // parent-id -- index of the parent span or null if root node
|
25
|
-
# 0292352, // Span start timestamp in 0.1ms granularity, relative to the start of the trace
|
26
|
-
# 20, // Duration of the span in 0.1ms granularity
|
27
|
-
# "action_controller.process", // Span category
|
28
|
-
# "Processing WidgetsController#index", // Span title, max 60 chars (optional)
|
29
|
-
# "", // Span description, string any size (optional)
|
30
|
-
# {}, // Map String->String
|
31
|
-
# ],
|
32
|
-
# [
|
33
|
-
# 0, // The previous span is this span's parent
|
34
|
-
# 1340923,
|
35
|
-
# 0, // No duration
|
36
|
-
# "log.info", // category "foo" "\"foo\"
|
37
|
-
# "Title", // Title
|
38
|
-
# "Doing some stuff..." // Span description
|
39
|
-
# {}, // Map String->String
|
40
|
-
# ]
|
41
|
-
# ]
|
42
|
-
# }
|
43
|
-
# ]
|
44
|
-
# },
|
45
|
-
# // etc...
|
46
|
-
# ]
|
47
|
-
# }
|
48
|
-
# }
|
49
|
-
|
50
|
-
hash = {
|
51
|
-
:batch => {
|
52
|
-
:timestamp => Util.clock.to_seconds(from),
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
hash[:batch][:endpoints] = counts.map do |endpoint, count|
|
57
|
-
ehash = {
|
58
|
-
:name => endpoint,
|
59
|
-
:count => count
|
60
|
-
}
|
61
|
-
|
62
|
-
traces = sample.select{|t| t.endpoint == endpoint }
|
63
|
-
|
64
|
-
ehash[:traces] = traces.map do |t|
|
65
|
-
# thash = { :uuid => t.ident }
|
66
|
-
thash = { :uuid => "TODO" }
|
67
|
-
|
68
|
-
thash[:spans] = t.spans.map do |s|
|
69
|
-
[s.parent,
|
70
|
-
s.started_at,
|
71
|
-
s.ended_at - s.started_at,
|
72
|
-
s.category,
|
73
|
-
s.title,
|
74
|
-
s.description,
|
75
|
-
s.annotations
|
76
|
-
]
|
77
|
-
end
|
78
|
-
|
79
|
-
thash
|
80
|
-
end
|
81
|
-
|
82
|
-
ehash
|
83
|
-
end
|
84
|
-
|
85
|
-
out << hash.to_json
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
data/lib/skylight/normalize.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
module Skylight
|
2
|
-
module Normalize
|
3
|
-
@registry = {}
|
4
|
-
|
5
|
-
def self.normalize(trace, name, payload, config={})
|
6
|
-
klass = @registry[name]
|
7
|
-
|
8
|
-
if klass
|
9
|
-
klass.new(trace, name, payload, config).normalize
|
10
|
-
else
|
11
|
-
Default.new(trace, name, payload, config).normalize
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.register(name, klass)
|
16
|
-
@registry[name] = klass
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class Normalizer
|
21
|
-
def self.register(name)
|
22
|
-
Normalize.register(name, self)
|
23
|
-
end
|
24
|
-
|
25
|
-
def initialize(trace, name, payload, config={})
|
26
|
-
@trace, @name, @payload, @config = trace, name, payload, config
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class RenderNormalizer < Normalizer
|
31
|
-
private
|
32
|
-
def normalize_render(category, payload)
|
33
|
-
path = @payload[:identifier]
|
34
|
-
|
35
|
-
title = relative_path(path)
|
36
|
-
path = nil if path == title
|
37
|
-
[ category, title, path, payload ]
|
38
|
-
end
|
39
|
-
|
40
|
-
def relative_path(path)
|
41
|
-
root_path = @config.view_paths.find do |p|
|
42
|
-
path.start_with?(p)
|
43
|
-
end
|
44
|
-
|
45
|
-
if root_path
|
46
|
-
relative = path[root_path.size..-1]
|
47
|
-
relative = relative[1..-1] if relative.start_with?("/")
|
48
|
-
relative
|
49
|
-
else
|
50
|
-
path
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
require "skylight/normalize/default"
|
57
|
-
require "skylight/normalize/start_processing"
|
58
|
-
require "skylight/normalize/process_action"
|
59
|
-
require "skylight/normalize/render_collection"
|
60
|
-
require "skylight/normalize/render_template"
|
61
|
-
require "skylight/normalize/render_partial"
|
62
|
-
require "skylight/normalize/send_file"
|
63
|
-
require "skylight/normalize/sql"
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Skylight
|
2
|
-
module Normalize
|
3
|
-
class Default < Normalizer
|
4
|
-
REGEX = /^(?:#{TIERS.join('|')})(?:\.|$)/
|
5
|
-
|
6
|
-
def normalize
|
7
|
-
if @name =~ REGEX
|
8
|
-
annot = @payload.dup
|
9
|
-
[ @name, annot.delete(:title), annot.delete(:description), annot ]
|
10
|
-
else
|
11
|
-
:skip
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Skylight
|
2
|
-
module Normalize
|
3
|
-
class ProcessAction < Normalizer
|
4
|
-
register "process_action.action_controller"
|
5
|
-
|
6
|
-
def normalize
|
7
|
-
@trace.endpoint = controller_action
|
8
|
-
[ "app.controller.request", controller_action, nil, @payload ]
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
def controller_action
|
13
|
-
"#{@payload[:controller]}##{@payload[:action]}"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|