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/.github/CODEOWNERS
ADDED
data/.rubocop.yml
CHANGED
@@ -22,11 +22,16 @@ Metrics/ClassLength:
|
|
22
22
|
|
23
23
|
Metrics/MethodLength:
|
24
24
|
Max: 25
|
25
|
+
Exclude:
|
26
|
+
- lib/generators/honeycomb/honeycomb_generator.rb
|
25
27
|
|
26
28
|
Metrics/LineLength:
|
27
29
|
Exclude:
|
28
30
|
- spec/support/event_data_shared_examples.rb
|
29
31
|
|
32
|
+
Metrics/ParameterLists:
|
33
|
+
Max: 6
|
34
|
+
|
30
35
|
Style/FrozenStringLiteralComment:
|
31
36
|
EnforcedStyle: always
|
32
37
|
Exclude:
|
data/Appraisals
CHANGED
@@ -8,8 +8,12 @@ appraise "aws-3" do
|
|
8
8
|
gem "aws-sdk", "~> 3"
|
9
9
|
end
|
10
10
|
|
11
|
-
appraise "faraday" do
|
12
|
-
gem "faraday"
|
11
|
+
appraise "faraday-0" do
|
12
|
+
gem "faraday", "~> 0"
|
13
|
+
end
|
14
|
+
|
15
|
+
appraise "faraday-1" do
|
16
|
+
gem "faraday", "~> 1"
|
13
17
|
end
|
14
18
|
|
15
19
|
appraise "sequel4" do
|
@@ -35,30 +39,35 @@ end
|
|
35
39
|
appraise "rails-41" do
|
36
40
|
gem "rack-test"
|
37
41
|
gem "rails", "~> 4.1.0"
|
42
|
+
gem "sprockets", "~> 3"
|
38
43
|
gem "warden"
|
39
44
|
end
|
40
45
|
|
41
46
|
appraise "rails-42" do
|
42
47
|
gem "rack-test"
|
43
48
|
gem "rails", "~> 4.2.0"
|
49
|
+
gem "sprockets", "~> 3"
|
44
50
|
gem "warden"
|
45
51
|
end
|
46
52
|
|
47
53
|
appraise "rails-5" do
|
48
54
|
gem "rack-test"
|
49
55
|
gem "rails", "~> 5.0.0"
|
56
|
+
gem "sprockets", "~> 3"
|
50
57
|
gem "warden"
|
51
58
|
end
|
52
59
|
|
53
60
|
appraise "rails-51" do
|
54
61
|
gem "rack-test"
|
55
62
|
gem "rails", "~> 5.1.0"
|
63
|
+
gem "sprockets", "~> 3"
|
56
64
|
gem "warden"
|
57
65
|
end
|
58
66
|
|
59
67
|
appraise "rails-52" do
|
60
68
|
gem "rack-test"
|
61
69
|
gem "rails", "~> 5.2.0"
|
70
|
+
gem "sprockets", "~> 3"
|
62
71
|
gem "warden"
|
63
72
|
end
|
64
73
|
|
data/Gemfile.lock
CHANGED
@@ -1,24 +1,27 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
honeycomb-beeline (
|
5
|
-
libhoney (~> 1.
|
4
|
+
honeycomb-beeline (2.2.0)
|
5
|
+
libhoney (~> 1.14, >= 1.14.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
addressable (2.
|
11
|
-
public_suffix (>= 2.0.2, <
|
10
|
+
addressable (2.7.0)
|
11
|
+
public_suffix (>= 2.0.2, < 5.0)
|
12
12
|
ansi (1.5.0)
|
13
13
|
appraisal (2.2.0)
|
14
14
|
bundler
|
15
15
|
rake
|
16
16
|
thor (>= 0.14.0)
|
17
17
|
ast (2.4.0)
|
18
|
-
bump (0.
|
19
|
-
byebug (
|
18
|
+
bump (0.9.0)
|
19
|
+
byebug (10.0.2)
|
20
20
|
childprocess (0.9.0)
|
21
21
|
ffi (~> 1.0, >= 1.0.11)
|
22
|
+
codecov (0.2.8)
|
23
|
+
json
|
24
|
+
simplecov
|
22
25
|
coderay (1.1.2)
|
23
26
|
crack (0.4.3)
|
24
27
|
safe_yaml (~> 1.0.0)
|
@@ -26,56 +29,56 @@ GEM
|
|
26
29
|
docile (1.3.2)
|
27
30
|
domain_name (0.5.20190701)
|
28
31
|
unf (>= 0.0.5, < 1.0.0)
|
29
|
-
ffi (1.
|
32
|
+
ffi (1.12.2)
|
30
33
|
ffi-compiler (1.0.1)
|
31
34
|
ffi (>= 1.0.0)
|
32
35
|
rake
|
33
|
-
hashdiff (0.
|
34
|
-
http (4.
|
36
|
+
hashdiff (1.0.1)
|
37
|
+
http (4.4.1)
|
35
38
|
addressable (~> 2.3)
|
36
39
|
http-cookie (~> 1.0)
|
37
|
-
http-form_data (~> 2.
|
40
|
+
http-form_data (~> 2.2)
|
38
41
|
http-parser (~> 1.2.0)
|
39
42
|
http-cookie (1.0.3)
|
40
43
|
domain_name (~> 0.5)
|
41
|
-
http-form_data (2.
|
44
|
+
http-form_data (2.3.0)
|
42
45
|
http-parser (1.2.1)
|
43
46
|
ffi-compiler (>= 1.0, < 2.0)
|
44
|
-
iniparse (1.
|
45
|
-
jaro_winkler (1.5.
|
46
|
-
json (2.
|
47
|
-
libhoney (1.14.
|
47
|
+
iniparse (1.5.0)
|
48
|
+
jaro_winkler (1.5.4)
|
49
|
+
json (2.3.1)
|
50
|
+
libhoney (1.14.5)
|
48
51
|
addressable (~> 2.0)
|
49
52
|
http (>= 2.0, < 5.0)
|
50
53
|
method_source (0.9.2)
|
51
54
|
overcommit (0.46.0)
|
52
55
|
childprocess (~> 0.6, >= 0.6.3)
|
53
56
|
iniparse (~> 1.4)
|
54
|
-
parallel (1.
|
55
|
-
parser (2.
|
57
|
+
parallel (1.19.1)
|
58
|
+
parser (2.7.1.2)
|
56
59
|
ast (~> 2.4.0)
|
57
60
|
pry (0.12.2)
|
58
61
|
coderay (~> 1.1.0)
|
59
62
|
method_source (~> 0.9.0)
|
60
|
-
pry-byebug (3.
|
61
|
-
byebug (~>
|
63
|
+
pry-byebug (3.6.0)
|
64
|
+
byebug (~> 10.0)
|
62
65
|
pry (~> 0.10)
|
63
|
-
public_suffix (
|
66
|
+
public_suffix (4.0.4)
|
64
67
|
rainbow (3.0.0)
|
65
|
-
rake (
|
66
|
-
rspec (3.
|
67
|
-
rspec-core (~> 3.
|
68
|
-
rspec-expectations (~> 3.
|
69
|
-
rspec-mocks (~> 3.
|
70
|
-
rspec-core (3.
|
71
|
-
rspec-support (~> 3.
|
72
|
-
rspec-expectations (3.
|
68
|
+
rake (13.0.1)
|
69
|
+
rspec (3.9.0)
|
70
|
+
rspec-core (~> 3.9.0)
|
71
|
+
rspec-expectations (~> 3.9.0)
|
72
|
+
rspec-mocks (~> 3.9.0)
|
73
|
+
rspec-core (3.9.2)
|
74
|
+
rspec-support (~> 3.9.3)
|
75
|
+
rspec-expectations (3.9.2)
|
73
76
|
diff-lcs (>= 1.2.0, < 2.0)
|
74
|
-
rspec-support (~> 3.
|
75
|
-
rspec-mocks (3.
|
77
|
+
rspec-support (~> 3.9.0)
|
78
|
+
rspec-mocks (3.9.1)
|
76
79
|
diff-lcs (>= 1.2.0, < 2.0)
|
77
|
-
rspec-support (~> 3.
|
78
|
-
rspec-support (3.
|
80
|
+
rspec-support (~> 3.9.0)
|
81
|
+
rspec-support (3.9.3)
|
79
82
|
rubocop (0.68.1)
|
80
83
|
jaro_winkler (~> 1.5.1)
|
81
84
|
parallel (~> 1.10)
|
@@ -87,23 +90,22 @@ GEM
|
|
87
90
|
rubocop (>= 0.68.0)
|
88
91
|
ruby-progressbar (1.10.1)
|
89
92
|
safe_yaml (1.0.5)
|
90
|
-
simplecov (0.
|
93
|
+
simplecov (0.18.5)
|
91
94
|
docile (~> 1.1)
|
92
|
-
|
93
|
-
|
94
|
-
simplecov-console (0.5.0)
|
95
|
+
simplecov-html (~> 0.11)
|
96
|
+
simplecov-console (0.7.2)
|
95
97
|
ansi
|
96
98
|
simplecov
|
97
99
|
terminal-table
|
98
|
-
simplecov-html (0.
|
100
|
+
simplecov-html (0.12.2)
|
99
101
|
terminal-table (1.8.0)
|
100
102
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
101
|
-
thor (0.
|
103
|
+
thor (1.0.1)
|
102
104
|
unf (0.1.4)
|
103
105
|
unf_ext
|
104
|
-
unf_ext (0.0.7.
|
106
|
+
unf_ext (0.0.7.7)
|
105
107
|
unicode-display_width (1.5.0)
|
106
|
-
webmock (3.
|
108
|
+
webmock (3.8.3)
|
107
109
|
addressable (>= 2.3.6)
|
108
110
|
crack (>= 0.3.2)
|
109
111
|
hashdiff (>= 0.4.0, < 2.0.0)
|
@@ -115,9 +117,11 @@ DEPENDENCIES
|
|
115
117
|
appraisal
|
116
118
|
bump
|
117
119
|
bundler
|
120
|
+
codecov
|
118
121
|
honeycomb-beeline!
|
119
122
|
overcommit (~> 0.46.0)
|
120
|
-
pry
|
123
|
+
pry (< 0.13.0)
|
124
|
+
pry-byebug (~> 3.6.0)
|
121
125
|
rake
|
122
126
|
rspec (~> 3.0)
|
123
127
|
rubocop (< 0.69)
|
@@ -127,4 +131,4 @@ DEPENDENCIES
|
|
127
131
|
webmock
|
128
132
|
|
129
133
|
BUNDLED WITH
|
130
|
-
2.
|
134
|
+
2.1.4
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://circleci.com/gh/honeycombio/beeline-ruby)
|
4
4
|
[](https://badge.fury.io/rb/honeycomb-beeline)
|
5
|
+
[](https://codecov.io/gh/honeycombio/beeline-ruby)
|
5
6
|
|
6
7
|
This package makes it easy to instrument your Ruby web app to send useful events to [Honeycomb](https://www.honeycomb.io), a service for debugging your software in production.
|
7
8
|
- [Usage and Examples](https://docs.honeycomb.io/getting-data-in/beelines/ruby-beeline/)
|
data/honeycomb-beeline.gemspec
CHANGED
@@ -37,13 +37,15 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
38
38
|
spec.require_paths = ["lib"]
|
39
39
|
|
40
|
-
spec.add_dependency "libhoney", "~> 1.
|
40
|
+
spec.add_dependency "libhoney", ">= 1.14.2", "~> 1.14"
|
41
41
|
|
42
42
|
spec.add_development_dependency "appraisal"
|
43
43
|
spec.add_development_dependency "bump"
|
44
44
|
spec.add_development_dependency "bundler"
|
45
|
+
spec.add_development_dependency "codecov"
|
45
46
|
spec.add_development_dependency "overcommit", "~> 0.46.0"
|
46
|
-
spec.add_development_dependency "pry
|
47
|
+
spec.add_development_dependency "pry", "< 0.13.0"
|
48
|
+
spec.add_development_dependency "pry-byebug", "~> 3.6.0"
|
47
49
|
spec.add_development_dependency "rake"
|
48
50
|
spec.add_development_dependency "rspec", "~> 3.0"
|
49
51
|
spec.add_development_dependency "rubocop", "< 0.69"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "rails/generators"
|
4
|
+
require "active_support/core_ext/string/strip"
|
4
5
|
|
5
6
|
##
|
6
7
|
# Generates an intializer for configuring the Honeycomb beeline
|
@@ -22,6 +23,19 @@ class HoneycombGenerator < Rails::Generators::Base
|
|
22
23
|
Honeycomb.configure do |config|
|
23
24
|
config.write_key = #{write_key.inspect}
|
24
25
|
config.dataset = #{options['dataset'].inspect}
|
26
|
+
config.presend_hook do |fields|
|
27
|
+
if fields["name"] == "redis" && fields.has_key?("redis.command")
|
28
|
+
# remove potential PII from the redis command
|
29
|
+
if fields["redis.command"].respond_to? :split
|
30
|
+
fields["redis.command"] = fields["redis.command"].split.first
|
31
|
+
end
|
32
|
+
end
|
33
|
+
if fields["name"] == "sql.active_record"
|
34
|
+
# remove potential PII from the active record events
|
35
|
+
fields.delete("sql.active_record.binds")
|
36
|
+
fields.delete("sql.active_record.type_casted_binds")
|
37
|
+
end
|
38
|
+
end
|
25
39
|
config.notification_events = %w[
|
26
40
|
sql.active_record
|
27
41
|
render_template.action_view
|
data/lib/honeycomb-beeline.rb
CHANGED
@@ -25,7 +25,8 @@ module Honeycomb
|
|
25
25
|
extend Forwardable
|
26
26
|
attr_reader :client
|
27
27
|
|
28
|
-
def_delegators :@client, :start_span, :add_field,
|
28
|
+
def_delegators :@client, :libhoney, :start_span, :add_field,
|
29
|
+
:add_field_to_trace, :current_span, :current_trace
|
29
30
|
|
30
31
|
def configure
|
31
32
|
Configuration.new.tap do |config|
|
data/lib/honeycomb/client.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "forwardable"
|
3
4
|
require "honeycomb/beeline/version"
|
4
5
|
require "honeycomb/configuration"
|
5
6
|
require "honeycomb/context"
|
@@ -7,18 +8,28 @@ require "honeycomb/context"
|
|
7
8
|
module Honeycomb
|
8
9
|
# The Honeycomb Beeline client
|
9
10
|
class Client
|
11
|
+
extend Forwardable
|
12
|
+
|
13
|
+
attr_reader :libhoney
|
14
|
+
|
15
|
+
def_delegators :@context, :current_span, :current_trace
|
16
|
+
|
10
17
|
def initialize(configuration:)
|
11
|
-
@
|
18
|
+
@libhoney = configuration.client
|
12
19
|
# attempt to set the user_agent_addition, this will only work if the
|
13
20
|
# client has not sent an event prior to being passed in here. This should
|
14
21
|
# be most cases
|
15
|
-
@
|
16
|
-
|
17
|
-
@
|
18
|
-
@
|
22
|
+
@libhoney.instance_variable_set(:@user_agent_addition,
|
23
|
+
Honeycomb::Beeline::USER_AGENT_SUFFIX)
|
24
|
+
@libhoney.add_field "meta.beeline_version", Honeycomb::Beeline::VERSION
|
25
|
+
@libhoney.add_field "meta.local_hostname", configuration.host_name
|
26
|
+
|
27
|
+
integrations = Honeycomb.integrations_to_load
|
28
|
+
@libhoney.add_field "meta.instrumentations_count", integrations.count
|
29
|
+
@libhoney.add_field "meta.instrumentations", integrations.map(&:to_s).to_s
|
19
30
|
|
20
31
|
# maybe make `service_name` a required parameter
|
21
|
-
@
|
32
|
+
@libhoney.add_field "service_name", configuration.service_name
|
22
33
|
@context = Context.new
|
23
34
|
|
24
35
|
@additional_trace_options = {
|
@@ -29,38 +40,38 @@ module Honeycomb
|
|
29
40
|
configuration.after_initialize(self)
|
30
41
|
|
31
42
|
at_exit do
|
32
|
-
|
43
|
+
libhoney.close
|
33
44
|
end
|
34
45
|
end
|
35
46
|
|
36
47
|
def start_span(name:, serialized_trace: nil, **fields)
|
37
48
|
if context.current_trace.nil?
|
38
49
|
Trace.new(serialized_trace: serialized_trace,
|
39
|
-
builder:
|
50
|
+
builder: libhoney.builder,
|
40
51
|
context: context,
|
41
52
|
**@additional_trace_options)
|
42
53
|
else
|
43
54
|
context.current_span.create_child
|
44
55
|
end
|
45
56
|
|
57
|
+
current_span = context.current_span
|
58
|
+
|
46
59
|
fields.each do |key, value|
|
47
|
-
|
60
|
+
current_span.add_field(key, value)
|
48
61
|
end
|
49
62
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
else
|
63
|
-
context.current_span
|
63
|
+
current_span.add_field("name", name)
|
64
|
+
|
65
|
+
return current_span unless block_given?
|
66
|
+
|
67
|
+
begin
|
68
|
+
yield current_span
|
69
|
+
rescue StandardError => e
|
70
|
+
current_span.add_field("error", e.class.name)
|
71
|
+
current_span.add_field("error_detail", e.message)
|
72
|
+
raise e
|
73
|
+
ensure
|
74
|
+
current_span.send
|
64
75
|
end
|
65
76
|
end
|
66
77
|
|
@@ -78,6 +89,6 @@ module Honeycomb
|
|
78
89
|
|
79
90
|
private
|
80
91
|
|
81
|
-
attr_reader :
|
92
|
+
attr_reader :context
|
82
93
|
end
|
83
94
|
end
|
@@ -34,7 +34,9 @@ module Honeycomb
|
|
34
34
|
on_notification_event.call(name, span, payload)
|
35
35
|
else
|
36
36
|
payload.each do |key, value|
|
37
|
-
|
37
|
+
# Make ActionController::Parameters parseable by libhoney.
|
38
|
+
value = value.to_unsafe_hash if value.respond_to?(:to_unsafe_hash)
|
39
|
+
span.add_field("#{name}.#{key}", value)
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
@@ -63,7 +65,7 @@ module Honeycomb
|
|
63
65
|
def finish(name, id, payload)
|
64
66
|
return unless (span = spans[id].pop)
|
65
67
|
|
66
|
-
|
68
|
+
handler_for(name).call(name, span, payload)
|
67
69
|
|
68
70
|
span.send
|
69
71
|
end
|
@@ -75,6 +77,16 @@ module Honeycomb
|
|
75
77
|
def spans
|
76
78
|
Thread.current[key] ||= Hash.new { |h, id| h[id] = [] }
|
77
79
|
end
|
80
|
+
|
81
|
+
def handler_for(name)
|
82
|
+
handlers.fetch(name) do
|
83
|
+
handlers[
|
84
|
+
handlers.keys.detect do |key|
|
85
|
+
key.is_a?(Regexp) && key =~ name
|
86
|
+
end
|
87
|
+
]
|
88
|
+
end
|
89
|
+
end
|
78
90
|
end
|
79
91
|
end
|
80
92
|
end
|