honeycomb-beeline 1.3.0 → 2.2.0
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/.circleci/config.yml +95 -549
- data/.github/CODEOWNERS +5 -0
- data/.rubocop.yml +5 -0
- data/Appraisals +11 -2
- data/Gemfile.lock +46 -42
- data/README.md +1 -0
- data/honeycomb-beeline.gemspec +4 -2
- data/lib/generators/honeycomb/honeycomb_generator.rb +14 -0
- data/lib/honeycomb-beeline.rb +2 -1
- data/lib/honeycomb/beeline/version.rb +1 -1
- data/lib/honeycomb/client.rb +35 -24
- data/lib/honeycomb/configuration.rb +1 -1
- data/lib/honeycomb/integrations/active_support.rb +14 -2
- data/lib/honeycomb/integrations/aws.rb +5 -1
- data/lib/honeycomb/integrations/faraday.rb +1 -1
- data/lib/honeycomb/integrations/rack.rb +15 -4
- data/lib/honeycomb/integrations/rails.rb +70 -20
- data/lib/honeycomb/integrations/railtie.rb +2 -3
- data/lib/honeycomb/integrations/redis.rb +3 -1
- data/lib/honeycomb/integrations/warden.rb +2 -2
- data/lib/honeycomb/propagation.rb +4 -51
- data/lib/honeycomb/propagation/aws.rb +66 -0
- data/lib/honeycomb/propagation/honeycomb.rb +69 -0
- data/lib/honeycomb/propagation/w3c.rb +55 -0
- data/lib/honeycomb/span.rb +37 -11
- data/lib/honeycomb/trace.rb +12 -1
- metadata +46 -8
data/lib/honeycomb/span.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "securerandom"
|
4
3
|
require "forwardable"
|
4
|
+
require "securerandom"
|
5
5
|
require "honeycomb/propagation"
|
6
6
|
require "honeycomb/deterministic_sampler"
|
7
7
|
require "honeycomb/rollup_fields"
|
@@ -24,7 +24,7 @@ module Honeycomb
|
|
24
24
|
builder:,
|
25
25
|
context:,
|
26
26
|
**options)
|
27
|
-
@id =
|
27
|
+
@id = generate_span_id
|
28
28
|
@context = context
|
29
29
|
@context.current_span = self
|
30
30
|
@builder = builder
|
@@ -36,11 +36,16 @@ module Honeycomb
|
|
36
36
|
parse_options(**options)
|
37
37
|
end
|
38
38
|
|
39
|
-
def parse_options(
|
39
|
+
def parse_options(parent: nil,
|
40
|
+
parent_id: nil,
|
40
41
|
is_root: parent_id.nil?,
|
41
42
|
sample_hook: nil,
|
42
43
|
presend_hook: nil,
|
43
44
|
**_options)
|
45
|
+
@parent = parent
|
46
|
+
# parent_id should be removed in the next major version bump. It has been
|
47
|
+
# replaced with passing the actual parent in. This is kept for backwards
|
48
|
+
# compatability
|
44
49
|
@parent_id = parent_id
|
45
50
|
@is_root = is_root
|
46
51
|
@presend_hook = presend_hook
|
@@ -51,6 +56,7 @@ module Honeycomb
|
|
51
56
|
self.class.new(trace: trace,
|
52
57
|
builder: builder,
|
53
58
|
context: context,
|
59
|
+
parent: self,
|
54
60
|
parent_id: id,
|
55
61
|
sample_hook: sample_hook,
|
56
62
|
presend_hook: presend_hook).tap do |c|
|
@@ -73,9 +79,16 @@ module Honeycomb
|
|
73
79
|
send_internal
|
74
80
|
end
|
75
81
|
|
82
|
+
def remove_child(child)
|
83
|
+
children.delete child
|
84
|
+
end
|
85
|
+
|
76
86
|
private
|
77
87
|
|
88
|
+
INVALID_SPAN_ID = ("00" * 8)
|
89
|
+
|
78
90
|
attr_reader :event,
|
91
|
+
:parent,
|
79
92
|
:parent_id,
|
80
93
|
:children,
|
81
94
|
:builder,
|
@@ -92,14 +105,7 @@ module Honeycomb
|
|
92
105
|
end
|
93
106
|
|
94
107
|
def send_internal
|
95
|
-
|
96
|
-
add_field "trace.trace_id", trace.id
|
97
|
-
add_field "trace.span_id", id
|
98
|
-
add_field "meta.span_type", span_type
|
99
|
-
parent_id && add_field("trace.parent_id", parent_id)
|
100
|
-
add rollup_fields
|
101
|
-
add trace.fields
|
102
|
-
span_type == "root" && add(trace.rollup_fields)
|
108
|
+
add_additional_fields
|
103
109
|
send_children
|
104
110
|
sample = true
|
105
111
|
if sample_hook.nil?
|
@@ -114,6 +120,19 @@ module Honeycomb
|
|
114
120
|
end
|
115
121
|
@sent = true
|
116
122
|
context.span_sent(self)
|
123
|
+
|
124
|
+
parent && parent.remove_child(self)
|
125
|
+
end
|
126
|
+
|
127
|
+
def add_additional_fields
|
128
|
+
add_field "duration_ms", duration_ms
|
129
|
+
add_field "trace.trace_id", trace.id
|
130
|
+
add_field "trace.span_id", id
|
131
|
+
add_field "meta.span_type", span_type
|
132
|
+
parent_id && add_field("trace.parent_id", parent_id)
|
133
|
+
add rollup_fields
|
134
|
+
add trace.fields
|
135
|
+
span_type == "root" && add(trace.rollup_fields)
|
117
136
|
end
|
118
137
|
|
119
138
|
def send_children
|
@@ -139,5 +158,12 @@ module Honeycomb
|
|
139
158
|
"mid"
|
140
159
|
end
|
141
160
|
end
|
161
|
+
|
162
|
+
def generate_span_id
|
163
|
+
loop do
|
164
|
+
id = SecureRandom.hex(8)
|
165
|
+
return id unless id == INVALID_SPAN_ID
|
166
|
+
end
|
167
|
+
end
|
142
168
|
end
|
143
169
|
end
|
data/lib/honeycomb/trace.rb
CHANGED
@@ -21,7 +21,7 @@ module Honeycomb
|
|
21
21
|
trace_id, parent_span_id, trace_fields, dataset =
|
22
22
|
parse serialized_trace
|
23
23
|
dataset && builder.dataset = dataset
|
24
|
-
@id = trace_id ||
|
24
|
+
@id = trace_id || generate_trace_id
|
25
25
|
@fields = trace_fields || {}
|
26
26
|
@root_span = Span.new(trace: self,
|
27
27
|
parent_id: parent_span_id,
|
@@ -34,5 +34,16 @@ module Honeycomb
|
|
34
34
|
def add_field(key, value)
|
35
35
|
@fields[key] = value
|
36
36
|
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
INVALID_TRACE_ID = ("00" * 16)
|
41
|
+
|
42
|
+
def generate_trace_id
|
43
|
+
loop do
|
44
|
+
id = SecureRandom.hex(16)
|
45
|
+
return id unless id == INVALID_TRACE_ID
|
46
|
+
end
|
47
|
+
end
|
37
48
|
end
|
38
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: honeycomb-beeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Holman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: libhoney
|
@@ -16,14 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.14'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.14.2
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
29
|
+
version: '1.14'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.14.2
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: appraisal
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +72,20 @@ dependencies:
|
|
66
72
|
- - ">="
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: codecov
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
69
89
|
- !ruby/object:Gem::Dependency
|
70
90
|
name: overcommit
|
71
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,20 +100,34 @@ dependencies:
|
|
80
100
|
- - "~>"
|
81
101
|
- !ruby/object:Gem::Version
|
82
102
|
version: 0.46.0
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: pry
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "<"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.13.0
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "<"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 0.13.0
|
83
117
|
- !ruby/object:Gem::Dependency
|
84
118
|
name: pry-byebug
|
85
119
|
requirement: !ruby/object:Gem::Requirement
|
86
120
|
requirements:
|
87
|
-
- - "
|
121
|
+
- - "~>"
|
88
122
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
123
|
+
version: 3.6.0
|
90
124
|
type: :development
|
91
125
|
prerelease: false
|
92
126
|
version_requirements: !ruby/object:Gem::Requirement
|
93
127
|
requirements:
|
94
|
-
- - "
|
128
|
+
- - "~>"
|
95
129
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
130
|
+
version: 3.6.0
|
97
131
|
- !ruby/object:Gem::Dependency
|
98
132
|
name: rake
|
99
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,6 +236,7 @@ files:
|
|
202
236
|
- ".circleci/bundler_version.sh"
|
203
237
|
- ".circleci/config.yml"
|
204
238
|
- ".circleci/setup-rubygems.sh"
|
239
|
+
- ".github/CODEOWNERS"
|
205
240
|
- ".gitignore"
|
206
241
|
- ".overcommit.yml"
|
207
242
|
- ".rspec"
|
@@ -238,6 +273,9 @@ files:
|
|
238
273
|
- lib/honeycomb/integrations/sinatra.rb
|
239
274
|
- lib/honeycomb/integrations/warden.rb
|
240
275
|
- lib/honeycomb/propagation.rb
|
276
|
+
- lib/honeycomb/propagation/aws.rb
|
277
|
+
- lib/honeycomb/propagation/honeycomb.rb
|
278
|
+
- lib/honeycomb/propagation/w3c.rb
|
241
279
|
- lib/honeycomb/rollup_fields.rb
|
242
280
|
- lib/honeycomb/span.rb
|
243
281
|
- lib/honeycomb/trace.rb
|