opencensus-jaeger 0.2.1 → 0.2.2.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/examples/.gitignore +1 -0
- data/examples/Gemfile +1 -0
- data/examples/Gemfile.lock +13 -12
- data/lib/opencensus/jaeger/version.rb +3 -1
- data/lib/opencensus/jaeger.rb +2 -0
- data/lib/opencensus/logging.rb +2 -0
- data/lib/opencensus/trace/exporters/jaeger_driver/intermediate_transport.rb +2 -0
- data/lib/opencensus/trace/exporters/jaeger_driver/udp_sender.rb +4 -2
- data/lib/opencensus/trace/exporters/jaeger_driver/udp_transport.rb +2 -0
- data/lib/opencensus/trace/exporters/jaeger_driver.rb +52 -8
- data/lib/opencensus/trace/exporters/jaeger_exporter.rb +5 -3
- data/lib/opencensus-jaeger.rb +2 -0
- data/opencensus-jaeger.gemspec +26 -24
- metadata +23 -12
- data/examples/.byebug_history +0 -97
- data/scripts/publish.rb +0 -7
- data/scripts/rename_collectors.rb +0 -88
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5dd7bb5db8172809eb77eee4d0768e0413a99041c6a3d946b12871c0161beec9
|
4
|
+
data.tar.gz: 7daba3d1c892723348e98c3d5930fe72a107d40549f5486a5e3429cf53dfa010
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55f55441d6c18c6382978f114902717b839243a29d1003a322ab755ae1e1f6425fb654f033973cf31b5d11749265b2785f5331af46dc884bee6a7904d9611144
|
7
|
+
data.tar.gz: 6acd01f7980d0aa18482c09269854ac8b8a024bac6b97990cea8a122e0e3e2f4c97b8d5a26542dea25b3f1742428ea382356ad75a11f5966b82af102173ec61f
|
data/examples/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.byebug_history
|
data/examples/Gemfile
CHANGED
data/examples/Gemfile.lock
CHANGED
@@ -1,41 +1,42 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
opencensus-jaeger (0.2.
|
5
|
-
opencensus (~> 0.
|
4
|
+
opencensus-jaeger (0.2.2)
|
5
|
+
opencensus (~> 0.5.0)
|
6
6
|
thrift (~> 0.11.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
+
byebug (11.0.1)
|
11
12
|
daemons (1.3.1)
|
12
13
|
eventmachine (1.2.7)
|
13
|
-
faraday (0.
|
14
|
+
faraday (0.17.0)
|
14
15
|
multipart-post (>= 1.2, < 3)
|
15
|
-
multipart-post (2.
|
16
|
+
multipart-post (2.1.1)
|
16
17
|
mustermann (1.0.3)
|
17
|
-
opencensus (0.
|
18
|
-
rack (2.0.
|
19
|
-
rack-protection (2.0.
|
18
|
+
opencensus (0.5.0)
|
19
|
+
rack (2.0.7)
|
20
|
+
rack-protection (2.0.7)
|
20
21
|
rack
|
21
|
-
sinatra (2.0.
|
22
|
+
sinatra (2.0.7)
|
22
23
|
mustermann (~> 1.0)
|
23
24
|
rack (~> 2.0)
|
24
|
-
rack-protection (= 2.0.
|
25
|
+
rack-protection (= 2.0.7)
|
25
26
|
tilt (~> 2.0)
|
26
27
|
thin (1.7.2)
|
27
28
|
daemons (~> 1.0, >= 1.0.9)
|
28
29
|
eventmachine (~> 1.0, >= 1.0.4)
|
29
30
|
rack (>= 1, < 3)
|
30
31
|
thrift (0.11.0.0)
|
31
|
-
tilt (2.0.
|
32
|
+
tilt (2.0.10)
|
32
33
|
|
33
34
|
PLATFORMS
|
34
35
|
ruby
|
35
|
-
x86_64-darwin-17
|
36
36
|
x86_64-darwin-18
|
37
37
|
|
38
38
|
DEPENDENCIES
|
39
|
+
byebug
|
39
40
|
faraday
|
40
41
|
opencensus
|
41
42
|
opencensus-jaeger!
|
@@ -43,4 +44,4 @@ DEPENDENCIES
|
|
43
44
|
thin
|
44
45
|
|
45
46
|
BUNDLED WITH
|
46
|
-
|
47
|
+
2.0.2
|
data/lib/opencensus/jaeger.rb
CHANGED
data/lib/opencensus/logging.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'opencensus/trace/exporters/jaeger_driver/udp_transport'
|
2
4
|
|
3
5
|
module OpenCensus
|
@@ -18,8 +20,8 @@ module OpenCensus
|
|
18
20
|
|
19
21
|
def send_spans(spans)
|
20
22
|
@client.emitBatch(spans)
|
21
|
-
rescue StandardError =>
|
22
|
-
@logger.error "Failure while sending a batch of spans: #{
|
23
|
+
rescue StandardError => e
|
24
|
+
@logger.error "Failure while sending a batch of spans: #{e}"
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'socket'
|
2
4
|
require 'thrift'
|
3
5
|
require 'opencensus/trace/exporters/jaeger_driver/intermediate_transport'
|
4
6
|
require 'opencensus/trace/exporters/jaeger_driver/udp_sender'
|
5
|
-
|
6
7
|
module OpenCensus
|
8
|
+
|
7
9
|
module Trace
|
8
10
|
module Exporters
|
9
11
|
module JaegerDriver
|
@@ -23,6 +25,8 @@ module OpenCensus
|
|
23
25
|
|
24
26
|
def encode_span(span)
|
25
27
|
tags = build_thrift_tags(span.attributes)
|
28
|
+
logs = build_logs(span.time_events)
|
29
|
+
references = build_references(span.links)
|
26
30
|
trace_id_high = base16_hex_to_int64(
|
27
31
|
span.trace_id.slice(0, 16)
|
28
32
|
)
|
@@ -36,10 +40,9 @@ module OpenCensus
|
|
36
40
|
span.parent_span_id
|
37
41
|
)
|
38
42
|
operation_name = span.name.value
|
39
|
-
references = []
|
40
43
|
flags = 0x01
|
41
|
-
start_time = span.start_time.to_f * 1_000_000
|
42
|
-
end_time = span.end_time.to_f * 1_000_000
|
44
|
+
start_time = (span.start_time.to_f * 1_000_000).to_i
|
45
|
+
end_time = (span.end_time.to_f * 1_000_000).to_i
|
43
46
|
duration = end_time - start_time
|
44
47
|
|
45
48
|
::Jaeger::Thrift::Span.new(
|
@@ -52,7 +55,8 @@ module OpenCensus
|
|
52
55
|
'flags': flags,
|
53
56
|
'startTime': start_time,
|
54
57
|
'duration': duration,
|
55
|
-
'tags': tags
|
58
|
+
'tags': tags,
|
59
|
+
'logs': logs
|
56
60
|
)
|
57
61
|
rescue StandardError => e
|
58
62
|
puts "convert error #{e}"
|
@@ -66,7 +70,7 @@ module OpenCensus
|
|
66
70
|
def base16_hex_id_to_uint64(id)
|
67
71
|
return nil unless id
|
68
72
|
value = id.to_i(16)
|
69
|
-
value > MAX_64BIT_UNSIGNED_INT || value
|
73
|
+
value > MAX_64BIT_UNSIGNED_INT || value.negative? ? 0 : value
|
70
74
|
end
|
71
75
|
|
72
76
|
# Thrift defines ID fields as i64, which is signed, therefore we convert
|
@@ -114,11 +118,51 @@ module OpenCensus
|
|
114
118
|
VSTR => value.to_s
|
115
119
|
)
|
116
120
|
end
|
117
|
-
rescue StandardError =>
|
118
|
-
logger.error "Cannot build thrift tags for #{key}:#{value}, error: #{
|
121
|
+
rescue StandardError => e
|
122
|
+
logger.error "Cannot build thrift tags for #{key}:#{value}, error: #{e}"
|
119
123
|
end
|
120
124
|
end
|
121
125
|
end
|
126
|
+
|
127
|
+
def build_logs(time_events)
|
128
|
+
time_events.map do |event|
|
129
|
+
::Jaeger::Thrift::Log.new(
|
130
|
+
'timestamp' => (event.time.to_f * 1_000_000).to_i,
|
131
|
+
'fields' => build_thrift_tags(
|
132
|
+
'message.id': event.id,
|
133
|
+
'message.type': event.type
|
134
|
+
)
|
135
|
+
)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def build_references(links)
|
140
|
+
links.map do |link|
|
141
|
+
::Jaeger::Thrift::SpanRef.new(
|
142
|
+
'refType' => build_span_ref(link.type),
|
143
|
+
'traceIdLow' => base16_hex_to_int64(
|
144
|
+
link.trace_id.slice(0, 16)
|
145
|
+
),
|
146
|
+
'traceIdHigh' => base16_hex_to_int64(
|
147
|
+
link.trace_id.slice(16)
|
148
|
+
),
|
149
|
+
'spanId' => base16_hex_to_int64(
|
150
|
+
link.span_id
|
151
|
+
)
|
152
|
+
)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def build_span_ref(type)
|
157
|
+
case type
|
158
|
+
when OpenCensus::Trace::CHILD_LINKED_SPAN
|
159
|
+
::Jaeger::Thrift::SpanRefType::CHILD_OF
|
160
|
+
when OpenTracing::Reference::PARENT_LINKED_SPAN
|
161
|
+
::Jaeger::Thrift::SpanRefType::FOLLOWS_FROM
|
162
|
+
else
|
163
|
+
logger.error "Cannot build thrift reference with #{ref_type}"
|
164
|
+
end
|
165
|
+
end
|
122
166
|
end
|
123
167
|
end
|
124
168
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'opencensus/trace/exporters/jaeger_driver'
|
2
4
|
|
3
5
|
module OpenCensus
|
@@ -5,9 +7,9 @@ module OpenCensus
|
|
5
7
|
module Exporters
|
6
8
|
class JaegerExporter
|
7
9
|
include ::Logging
|
8
|
-
JAEGER_OPENCENSUS_EXPORTER_VERSION_TAG_KEY = 'opencensus.exporter.jaeger.version'
|
9
|
-
TRACER_HOSTNAME_TAG_KEY = 'opencensus.exporter.jaeger.hostname'
|
10
|
-
PROCESS_IP = 'ip'
|
10
|
+
JAEGER_OPENCENSUS_EXPORTER_VERSION_TAG_KEY = 'opencensus.exporter.jaeger.version'
|
11
|
+
TRACER_HOSTNAME_TAG_KEY = 'opencensus.exporter.jaeger.hostname'
|
12
|
+
PROCESS_IP = 'ip'
|
11
13
|
DEFAULT_MAX_LENGTH = 65_000 # Jaeger agent only accepts up to 65_000
|
12
14
|
|
13
15
|
attr_reader :client, :span_batches
|
data/lib/opencensus-jaeger.rb
CHANGED
data/opencensus-jaeger.gemspec
CHANGED
@@ -1,45 +1,47 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'opencensus/jaeger/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = 'opencensus-jaeger'
|
8
9
|
spec.version = OpenCensus::Jaeger::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
10
|
+
spec.authors = ['Luong Vo']
|
11
|
+
spec.email = ['vo.tran.thanh.luong@gmail.com']
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
13
|
+
spec.summary = 'Jaeger exporter for OpenCensus'
|
14
|
+
spec.description = 'Jaeger exporter for OpenCensus'
|
15
|
+
spec.homepage = 'https://www.github.com/Thinkei/opencensus-ruby-exporter-jaeger'
|
16
|
+
spec.license = 'Apache-2.0'
|
16
17
|
|
17
18
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
19
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
20
|
if spec.respond_to?(:metadata)
|
20
|
-
|
21
|
-
|
22
|
-
spec.metadata[
|
23
|
-
spec.metadata[
|
24
|
-
spec.metadata[
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
22
|
+
#
|
23
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
24
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
25
|
+
spec.metadata['changelog_uri'] = 'https://github.com/Thinkei/opencensus-ruby-exporter-jaeger/blob/master/CHANGELOG.md'
|
26
|
+
# else
|
27
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
28
|
+
# "public gem pushes."
|
28
29
|
end
|
29
30
|
|
30
31
|
# Specify which files should be added to the gem when it is released.
|
31
32
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
32
|
-
spec.files
|
33
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
33
34
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
35
|
end
|
35
|
-
spec.bindir =
|
36
|
+
spec.bindir = 'exe'
|
36
37
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
37
|
-
spec.require_paths = [
|
38
|
+
spec.require_paths = ['lib']
|
38
39
|
|
39
|
-
spec.add_dependency
|
40
|
-
spec.add_dependency
|
40
|
+
spec.add_dependency 'opencensus', '~> 0.5.0'
|
41
|
+
spec.add_dependency 'thrift', '~> 0.11.0'
|
41
42
|
|
42
|
-
spec.add_development_dependency
|
43
|
-
spec.add_development_dependency
|
44
|
-
spec.add_development_dependency
|
43
|
+
spec.add_development_dependency 'pry-byebug'
|
44
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
45
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
46
|
+
spec.add_development_dependency 'rubocop'
|
45
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opencensus-jaeger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luong Vo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opencensus
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.5.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thrift
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.11.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry-byebug
|
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'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +81,7 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '3.0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: rubocop
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
@@ -102,7 +116,7 @@ files:
|
|
102
116
|
- Rakefile
|
103
117
|
- bin/console
|
104
118
|
- bin/setup
|
105
|
-
- examples/.
|
119
|
+
- examples/.gitignore
|
106
120
|
- examples/Gemfile
|
107
121
|
- examples/Gemfile.lock
|
108
122
|
- examples/config.ru
|
@@ -117,8 +131,6 @@ files:
|
|
117
131
|
- lib/opencensus/trace/exporters/jaeger_driver/udp_transport.rb
|
118
132
|
- lib/opencensus/trace/exporters/jaeger_exporter.rb
|
119
133
|
- opencensus-jaeger.gemspec
|
120
|
-
- scripts/publish.rb
|
121
|
-
- scripts/rename_collectors.rb
|
122
134
|
- thrift/agent.thrift
|
123
135
|
- thrift/gen-rb/jaeger/thrift/agent.rb
|
124
136
|
- thrift/gen-rb/jaeger/thrift/agent_constants.rb
|
@@ -149,12 +161,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
161
|
version: '0'
|
150
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
163
|
requirements:
|
152
|
-
- - "
|
164
|
+
- - ">"
|
153
165
|
- !ruby/object:Gem::Version
|
154
|
-
version:
|
166
|
+
version: 1.3.1
|
155
167
|
requirements: []
|
156
|
-
|
157
|
-
rubygems_version: 2.6.14.4
|
168
|
+
rubygems_version: 3.0.6
|
158
169
|
signing_key:
|
159
170
|
specification_version: 4
|
160
171
|
summary: Jaeger exporter for OpenCensus
|
data/examples/.byebug_history
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
c
|
2
|
-
continue
|
3
|
-
next
|
4
|
-
step
|
5
|
-
next
|
6
|
-
a.running?
|
7
|
-
a=OpenCensus.config.trace.exporter.instance_variable_get('@executor')
|
8
|
-
a.running?
|
9
|
-
next
|
10
|
-
a.running?
|
11
|
-
a=OpenCensus.config.trace.exporter.instance_variable_get('@executor')
|
12
|
-
a = _
|
13
|
-
OpenCensus.config.trace.exporter.instance_variable_get('@executor')
|
14
|
-
OpenCensus.config.trace.exporter.instance_variable_get('executor')
|
15
|
-
OpenCensus.config.trace.exporter.instance_variable_get(:executor)
|
16
|
-
OpenCensus.config.trace.exporter.running?
|
17
|
-
OpenCensus.config.trace.exporter
|
18
|
-
OpenCensus.config.trace.methods
|
19
|
-
OpenCensus.config.trace
|
20
|
-
OpenCensus.config.trcae
|
21
|
-
OpenCensus.config.methods
|
22
|
-
OpenCensus.config
|
23
|
-
next
|
24
|
-
value
|
25
|
-
field.value
|
26
|
-
next
|
27
|
-
field
|
28
|
-
field.exporter
|
29
|
-
field
|
30
|
-
key
|
31
|
-
next
|
32
|
-
key
|
33
|
-
@fields
|
34
|
-
field
|
35
|
-
n
|
36
|
-
'n
|
37
|
-
n
|
38
|
-
next
|
39
|
-
field
|
40
|
-
key
|
41
|
-
next
|
42
|
-
key
|
43
|
-
field.exporter.methods
|
44
|
-
field.exporter
|
45
|
-
field.methods
|
46
|
-
field
|
47
|
-
field.is_a? Config
|
48
|
-
field.value
|
49
|
-
@fields
|
50
|
-
field
|
51
|
-
fiel
|
52
|
-
next
|
53
|
-
backtrace
|
54
|
-
step
|
55
|
-
puts "#{c}"
|
56
|
-
step
|
57
|
-
next
|
58
|
-
step
|
59
|
-
c
|
60
|
-
step
|
61
|
-
next
|
62
|
-
step
|
63
|
-
continue
|
64
|
-
require 'jaeger/client'
|
65
|
-
continue
|
66
|
-
Jaeger.constants
|
67
|
-
Jaeger::Thrift
|
68
|
-
$LOAD_PATH
|
69
|
-
require_relative 'jaeger/client/../../thrift/gen-rb'
|
70
|
-
require 'jaeger/client/../../thrift/gen-rb'
|
71
|
-
require 'jaeger/client'
|
72
|
-
require 'jaeger/client/../../thrift/gen-rb'
|
73
|
-
require_relative 'jaeger/client/../../thrift/gen-rb'
|
74
|
-
require 'jaeger/client/../../thrift/gen-rb'
|
75
|
-
require 'jaeger/client'
|
76
|
-
require_relative 'jaeger/client/../../thrift/gen-rb'
|
77
|
-
__FILE__
|
78
|
-
File.dirname(__FILE__)
|
79
|
-
require 'jaeger'
|
80
|
-
$LOAD_PATH.push(File.dirname(__FILE__)+ '/../../thrift/gen-rb')
|
81
|
-
'
|
82
|
-
require 'jaeger/thrift/gen-rb/'
|
83
|
-
require 'jaeger/thrift/agent'
|
84
|
-
$LOAD_PATH.push(File.dirname(__FILE__)+ '/../../thrift/gen-rb')
|
85
|
-
require 'opentracing'
|
86
|
-
require 'jaeger/thrift/agent'
|
87
|
-
Jaeger::Thrift
|
88
|
-
Jaeger::Span.constants
|
89
|
-
Jaeger::Span.constant
|
90
|
-
Jaeger::Span.class
|
91
|
-
Jaeger::Span
|
92
|
-
Jaeger.constants
|
93
|
-
Jaeger.class
|
94
|
-
Jaeger.type
|
95
|
-
Jaeger.tyoe
|
96
|
-
Jaeger.methods
|
97
|
-
Jaeger
|
data/scripts/publish.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
lib = File.expand_path("../lib", __FILE__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require 'opencensus/jaeger/version'
|
4
|
-
|
5
|
-
version = OpenCensus::Jaeger::VERSION
|
6
|
-
|
7
|
-
exec("gem build opencensus-jaeger.gemspec && curl -F package=@opencensus-jaeger-#{version}.gem https://#{ENV['GEMFURY_TOKEN']}@push.fury.io/#{ENV['GEMFURY_PACKAGE']}/")
|
@@ -1,88 +0,0 @@
|
|
1
|
-
require 'parser/current'
|
2
|
-
require 'byebug'
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
class CollectorRewrite < Parser::Rewriter
|
6
|
-
def on_class(node)
|
7
|
-
klass = node.children.first
|
8
|
-
range = Parser::Source::Range.new(
|
9
|
-
klass.loc.expression,
|
10
|
-
klass.loc.expression.begin_pos,
|
11
|
-
klass.loc.expression.end_pos
|
12
|
-
)
|
13
|
-
replace(range, klass.children.last.to_s)
|
14
|
-
|
15
|
-
range = Parser::Source::Range.new(
|
16
|
-
node.loc.expression,
|
17
|
-
node.loc.expression.begin_pos,
|
18
|
-
node.loc.expression.end_pos
|
19
|
-
)
|
20
|
-
|
21
|
-
wrap(range, "module ::EhMonitoring::Collectors\n", "\nend")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class CollectorMigration < Parser::Rewriter
|
26
|
-
def on_const(node)
|
27
|
-
if node.children.last.to_s =~ /.*Collector$/ && node.children[-2].to_s != ~ /Collectors/
|
28
|
-
range = Parser::Source::Range.new(
|
29
|
-
node.loc.expression,
|
30
|
-
node.loc.expression.begin_pos,
|
31
|
-
node.loc.expression.end_pos
|
32
|
-
)
|
33
|
-
replace(range, "EhMonitoring::Collectors::#{node.children.last}")
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def on_send(node)
|
38
|
-
if node.children[1] == :require
|
39
|
-
file = node.children.last
|
40
|
-
file_link = file.children.first
|
41
|
-
if file_link =~ /collector$/ && file_link != ~ /collectors/
|
42
|
-
range = Parser::Source::Range.new(
|
43
|
-
file.loc.expression,
|
44
|
-
file.loc.expression.begin_pos,
|
45
|
-
file.loc.expression.end_pos
|
46
|
-
)
|
47
|
-
files = file_link.split "/"
|
48
|
-
replace(range, "\"#{files.insert(files.length - 1, "collectors").join("/")}\"")
|
49
|
-
end
|
50
|
-
elsif node.children[2]&.type == :const
|
51
|
-
on_const(node.children[2])
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
FileUtils.mkdir_p("lib/eh_monitoring/collectors")
|
57
|
-
FileUtils.mkdir_p("spec/units/eh_monitoring/collectors")
|
58
|
-
|
59
|
-
Dir["lib/**/*_collector.rb"].each do |file|
|
60
|
-
buffer = Parser::Source::Buffer.new("(Migration)")
|
61
|
-
buffer.source = File.read(file)
|
62
|
-
ast = Parser::CurrentRuby.new.parse(buffer)
|
63
|
-
rewriter = CollectorRewrite.new
|
64
|
-
content = rewriter.rewrite(buffer, ast)
|
65
|
-
lines = content.split("\n")
|
66
|
-
lines.each_with_index do |line, index|
|
67
|
-
next if index == 0 || index == lines.length - 1
|
68
|
-
lines[index] = " #{line}"
|
69
|
-
end
|
70
|
-
content = lines.join("\n")
|
71
|
-
File.write("lib/eh_monitoring/collectors/#{file.split("/").last}", content)
|
72
|
-
File.delete(file)
|
73
|
-
end
|
74
|
-
|
75
|
-
Dir["spec/units/eh_monitoring/*_collector_spec.rb"].each do |file|
|
76
|
-
File.write("spec/units/eh_monitoring/collectors/#{file.split("/").last}", File.read(file))
|
77
|
-
File.delete(file)
|
78
|
-
end
|
79
|
-
|
80
|
-
file = "spec/units/eh_monitoring/instance_spec.rb"
|
81
|
-
Dir["**/*.rb"].each do |file|
|
82
|
-
buffer = Parser::Source::Buffer.new("(Migration)")
|
83
|
-
buffer.source = File.read(file)
|
84
|
-
ast = Parser::CurrentRuby.new.parse(buffer)
|
85
|
-
rewriter = CollectorMigration.new
|
86
|
-
content = rewriter.rewrite(buffer, ast)
|
87
|
-
File.write(file, content)
|
88
|
-
end
|