honeycomb-beeline 2.11.1.pre.dev → 3.0.1
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 +3 -84
- data/.gitignore +3 -0
- data/.rubocop.yml +2 -6
- data/Appraisals +6 -14
- data/CHANGELOG.md +40 -0
- data/DEVELOPING.md +31 -0
- data/README.md +3 -1
- data/RELEASING.md +8 -4
- data/honeycomb-beeline.gemspec +4 -8
- data/lib/honeycomb/beeline/version.rb +3 -3
- data/lib/honeycomb/deterministic_sampler.rb +1 -1
- data/lib/honeycomb/integrations/aws.rb +1 -1
- data/lib/honeycomb/integrations/redis.rb +1 -1
- data/lib/honeycomb/propagation/aws.rb +4 -8
- data/lib/honeycomb/propagation/default_modern.rb +0 -2
- data/lib/honeycomb/propagation/honeycomb.rb +28 -16
- data/lib/honeycomb/propagation/honeycomb_modern.rb +21 -11
- data/lib/honeycomb/propagation/w3c.rb +3 -3
- data/lib/honeycomb/span.rb +2 -2
- data/lib/honeycomb-beeline.rb +2 -4
- metadata +15 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6be26f3bc54561c09f8c6c35ab53586a71fd46cbff7a6d926c9e38b4246d9f49
|
|
4
|
+
data.tar.gz: bd9723d71f943492047ecad4c3634c54520346c6b3bd75a50bfb72498cffb339
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd27f4f6844b6f691343e9fbdc2ea86b92a7a32e44005510d2e7d2270b0afa56a4ff1d7444608872f01cc053037a971d6c17a68d2548b3d3be34c327ed082989
|
|
7
|
+
data.tar.gz: fd2ce5459d4a2c2762d3c4caf625d120ae3fa15149ec288ee62c4d1eceb4b01618f66465e2e056684c1e2faebf4dceb1351364987c58e3a371ad037e879f262e
|
data/.circleci/config.yml
CHANGED
|
@@ -89,27 +89,6 @@ jobs:
|
|
|
89
89
|
ruby-version: << parameters.ruby-version >>
|
|
90
90
|
gemfile: root
|
|
91
91
|
command: bundle exec rake rubocop
|
|
92
|
-
test-older-versions: # need to use deprecated circleci/ruby images for older ruby versions
|
|
93
|
-
parameters:
|
|
94
|
-
gemfile:
|
|
95
|
-
type: string
|
|
96
|
-
ruby-version:
|
|
97
|
-
type: string
|
|
98
|
-
docker:
|
|
99
|
-
- image: circleci/ruby:<< parameters.ruby-version >>
|
|
100
|
-
environment:
|
|
101
|
-
BUNDLE_GEMFILE: gemfiles/<< parameters.gemfile >>.gemfile
|
|
102
|
-
steps:
|
|
103
|
-
- ruby:
|
|
104
|
-
ruby-version: << parameters.ruby-version >>
|
|
105
|
-
gemfile: << parameters.gemfile >>
|
|
106
|
-
command: bundle exec rake test
|
|
107
|
-
- store_test_results:
|
|
108
|
-
path: test/reports
|
|
109
|
-
- persist_to_workspace:
|
|
110
|
-
root: ./
|
|
111
|
-
paths:
|
|
112
|
-
- coverage
|
|
113
92
|
test:
|
|
114
93
|
parameters:
|
|
115
94
|
gemfile:
|
|
@@ -153,78 +132,23 @@ jobs:
|
|
|
153
132
|
path: coverage
|
|
154
133
|
|
|
155
134
|
workflows:
|
|
156
|
-
|
|
135
|
+
weekly:
|
|
157
136
|
triggers:
|
|
158
137
|
- schedule:
|
|
159
|
-
cron: "0 0 * *
|
|
138
|
+
cron: "0 0 * * 0"
|
|
160
139
|
filters:
|
|
161
140
|
branches:
|
|
162
141
|
only:
|
|
163
142
|
- main
|
|
164
143
|
jobs:
|
|
165
144
|
- lint
|
|
166
|
-
- test-older-versions: &test-older-versions # need to use deprecated circleci/ruby images for older ruby versions
|
|
167
|
-
name: test-<< matrix.gemfile >>-ruby_<< matrix.ruby-version >>
|
|
168
|
-
requires:
|
|
169
|
-
- lint
|
|
170
|
-
matrix:
|
|
171
|
-
parameters:
|
|
172
|
-
ruby-version: ["2.2", "2.3", "2.4", "2.5", "2.6"]
|
|
173
|
-
gemfile:
|
|
174
|
-
- aws_2
|
|
175
|
-
- aws_3
|
|
176
|
-
- faraday_0
|
|
177
|
-
- faraday_1
|
|
178
|
-
- sequel4
|
|
179
|
-
- sequel5
|
|
180
|
-
- sinatra
|
|
181
|
-
- rack_2
|
|
182
|
-
- rack_3
|
|
183
|
-
- rails_41
|
|
184
|
-
- rails_42
|
|
185
|
-
- rails_5
|
|
186
|
-
- rails_51
|
|
187
|
-
- rails_52
|
|
188
|
-
- rails_6
|
|
189
|
-
- rails_61
|
|
190
|
-
- redis_3
|
|
191
|
-
- redis_4
|
|
192
|
-
exclude:
|
|
193
|
-
- ruby-version: "2.2"
|
|
194
|
-
gemfile: faraday_0
|
|
195
|
-
- ruby-version: "2.2"
|
|
196
|
-
gemfile: faraday_1
|
|
197
|
-
- ruby-version: "2.2"
|
|
198
|
-
gemfile: rails_52
|
|
199
|
-
- ruby-version: "2.2"
|
|
200
|
-
gemfile: rails_6
|
|
201
|
-
- ruby-version: "2.2"
|
|
202
|
-
gemfile: rails_61
|
|
203
|
-
- ruby-version: "2.3"
|
|
204
|
-
gemfile: rails_6
|
|
205
|
-
- ruby-version: "2.3"
|
|
206
|
-
gemfile: rails_61
|
|
207
|
-
- ruby-version: "2.4"
|
|
208
|
-
gemfile: rails_6
|
|
209
|
-
- ruby-version: "2.4"
|
|
210
|
-
gemfile: rails_61
|
|
211
|
-
- ruby-version: "2.4"
|
|
212
|
-
gemfile: rails_41
|
|
213
|
-
- ruby-version: "2.5"
|
|
214
|
-
gemfile: rails_41
|
|
215
|
-
- ruby-version: "2.6"
|
|
216
|
-
gemfile: rails_41
|
|
217
|
-
- ruby-version: "2.2"
|
|
218
|
-
gemfile: rack_3
|
|
219
|
-
- ruby-version: "2.3"
|
|
220
|
-
gemfile: rack_3
|
|
221
145
|
- test: &test
|
|
222
146
|
name: test-<< matrix.gemfile >>-ruby_<< matrix.ruby-version >>
|
|
223
147
|
requires:
|
|
224
148
|
- lint
|
|
225
149
|
matrix:
|
|
226
150
|
parameters:
|
|
227
|
-
ruby-version: ["2.7", "3.0", "3.1"]
|
|
151
|
+
ruby-version: ["2.5","2.6", "2.7", "3.0", "3.1"]
|
|
228
152
|
gemfile:
|
|
229
153
|
- aws_2
|
|
230
154
|
- aws_3
|
|
@@ -266,9 +190,6 @@ workflows:
|
|
|
266
190
|
filters: ®ular_filters
|
|
267
191
|
tags:
|
|
268
192
|
only: /.*/
|
|
269
|
-
- test-older-versions: # need to use deprecated circleci/ruby images for older ruby versions
|
|
270
|
-
<<: *test-older-versions
|
|
271
|
-
filters: *regular_filters
|
|
272
193
|
- test:
|
|
273
194
|
<<: *test
|
|
274
195
|
filters: *regular_filters
|
|
@@ -276,7 +197,6 @@ workflows:
|
|
|
276
197
|
filters: *regular_filters
|
|
277
198
|
requires:
|
|
278
199
|
- test
|
|
279
|
-
- test-older-versions
|
|
280
200
|
- build_artifacts:
|
|
281
201
|
filters: &tag_filters
|
|
282
202
|
tags:
|
|
@@ -286,7 +206,6 @@ workflows:
|
|
|
286
206
|
requires:
|
|
287
207
|
- lint
|
|
288
208
|
- test
|
|
289
|
-
- test-older-versions
|
|
290
209
|
- publish_rubygems: &publish
|
|
291
210
|
filters: *tag_filters
|
|
292
211
|
requires:
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require: rubocop-performance
|
|
2
2
|
|
|
3
3
|
AllCops:
|
|
4
|
-
TargetRubyVersion: 2.
|
|
4
|
+
TargetRubyVersion: 2.5
|
|
5
5
|
Exclude:
|
|
6
6
|
- "examples/**/*"
|
|
7
7
|
- "vendor/**/*"
|
|
@@ -36,11 +36,7 @@ Metrics/ParameterLists:
|
|
|
36
36
|
Max: 6
|
|
37
37
|
|
|
38
38
|
Style/AccessModifierDeclarations:
|
|
39
|
-
|
|
40
|
-
- lib/honeycomb/propagation/aws.rb
|
|
41
|
-
- lib/honeycomb/propagation/w3c.rb
|
|
42
|
-
- lib/honeycomb/propagation/honeycomb.rb
|
|
43
|
-
- lib/honeycomb/propagation/default.rb
|
|
39
|
+
Enabled: false
|
|
44
40
|
|
|
45
41
|
Style/FrozenStringLiteralComment:
|
|
46
42
|
EnforcedStyle: always
|
data/Appraisals
CHANGED
|
@@ -44,20 +44,6 @@ appraise "rack-3" do
|
|
|
44
44
|
gem "warden"
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
appraise "rails-41" do
|
|
48
|
-
gem "rack-test"
|
|
49
|
-
gem "rails", "~> 4.1.0"
|
|
50
|
-
gem "sprockets", "~> 3"
|
|
51
|
-
gem "warden"
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
appraise "rails-42" do
|
|
55
|
-
gem "rack-test"
|
|
56
|
-
gem "rails", "~> 4.2.0"
|
|
57
|
-
gem "sprockets", "~> 3"
|
|
58
|
-
gem "warden"
|
|
59
|
-
end
|
|
60
|
-
|
|
61
47
|
appraise "rails-5" do
|
|
62
48
|
gem "rack-test"
|
|
63
49
|
gem "rails", "~> 5.0.0"
|
|
@@ -85,6 +71,12 @@ appraise "rails-6" do
|
|
|
85
71
|
gem "warden"
|
|
86
72
|
end
|
|
87
73
|
|
|
74
|
+
appraise "rails-61" do
|
|
75
|
+
gem "rack-test"
|
|
76
|
+
gem "rails", "~> 6.1.0"
|
|
77
|
+
gem "warden"
|
|
78
|
+
end
|
|
79
|
+
|
|
88
80
|
appraise "redis-3" do
|
|
89
81
|
gem "redis", "~> 3"
|
|
90
82
|
end
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# beeline-ruby changelog
|
|
2
2
|
|
|
3
|
+
## 3.0.1 2023-10-12
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- fix: clean invalid UTF8 from trace field values when generating propagation header (#232) | Robb Kidd
|
|
8
|
+
|
|
9
|
+
### Maintenance
|
|
10
|
+
|
|
11
|
+
- maint: add local dev notes and fix example (#233) | Jamie Danielson
|
|
12
|
+
- ci: move nightly to weekly (#230) | Vera Reynolds
|
|
13
|
+
- ci: AWS specs updated to use include() instead of match() (#229) | Robb Kidd
|
|
14
|
+
|
|
15
|
+
## 3.0.0 2023-06-08
|
|
16
|
+
|
|
17
|
+
### ⚠️ Breaking Changes ⚠️
|
|
18
|
+
|
|
19
|
+
Minimum Ruby version is 2.5 and minimum Rails version is 5.0.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- fix: set min rubocop to avoid false positive lint error (#218) | @robbkidd
|
|
24
|
+
|
|
25
|
+
### Maintenance
|
|
26
|
+
|
|
27
|
+
- chore: give dependabot PRs better title (#217) | @vreynolds
|
|
28
|
+
- ci: use context for publishing ruby gem (#219) | @JamieDanielson
|
|
29
|
+
- ci: update validate PR title workflow (#216) | @pkanal
|
|
30
|
+
- ci: validate PR title (#214) | @pkanal
|
|
31
|
+
- docs: update readme (#225) | @pkanal
|
|
32
|
+
- docs: add otel recommendation to readme (#222) | @pkanal
|
|
33
|
+
- maint: drop support for Ruby < 2.5 and Rails < 5.0 (#227) | @robbkidd
|
|
34
|
+
- maint: update author to honeycomb (#220) | @JamieDanielson
|
|
35
|
+
- maint: delete workflows for old board (#212) | @vreynolds
|
|
36
|
+
- maint: add release file (#211) | @vreynolds
|
|
37
|
+
- maint: add new project workflow (#210) | @vreynolds
|
|
38
|
+
- maint: handle recent Rack v3 changes in tests & example (#209) | @emilyashley
|
|
39
|
+
- maint: add ruby 3.1 to CI matrix (#206) | @vreynolds
|
|
40
|
+
- maint: fix nightly build (#205) | @vreynolds
|
|
41
|
+
- maint: drop testing for Faraday 0 under Ruby 2.2 (#204) | @robbkidd
|
|
42
|
+
|
|
3
43
|
## 2.11.0 2022-06-01
|
|
4
44
|
|
|
5
45
|
### Improvements
|
data/DEVELOPING.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Local Development
|
|
2
|
+
|
|
3
|
+
## Requirements
|
|
4
|
+
|
|
5
|
+
Ruby: <https://www.ruby-lang.org/en/documentation/installation/>
|
|
6
|
+
|
|
7
|
+
Rake:
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
gem install rake
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Install dependencies
|
|
14
|
+
|
|
15
|
+
```shell
|
|
16
|
+
bundle install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Run Tests
|
|
20
|
+
|
|
21
|
+
To run all tests:
|
|
22
|
+
|
|
23
|
+
```shell
|
|
24
|
+
bundle exec rake test
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
To run individual tests:
|
|
28
|
+
|
|
29
|
+
```shell
|
|
30
|
+
bundle exec rake test TEST=spec/honeycomb/trace_spec.rb
|
|
31
|
+
```
|
data/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
[](https://circleci.com/gh/honeycombio/beeline-ruby)
|
|
5
5
|
[](https://badge.fury.io/rb/honeycomb-beeline)
|
|
6
6
|
|
|
7
|
+
⚠️**Note**: Beelines are Honeycomb's legacy instrumentation libraries. We embrace OpenTelemetry as the effective way to instrument applications. For any new observability efforts, we recommend [instrumenting with OpenTelemetry](https://docs.honeycomb.io/getting-data-in/opentelemetry/ruby/).
|
|
8
|
+
|
|
7
9
|
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.
|
|
8
10
|
- [Usage and Examples](https://docs.honeycomb.io/getting-data-in/beelines/ruby-beeline/)
|
|
9
11
|
|
|
@@ -12,7 +14,7 @@ trial](https://ui.honeycomb.io/signup) to obtain an API key before starting.
|
|
|
12
14
|
|
|
13
15
|
## Compatible with
|
|
14
16
|
|
|
15
|
-
Requires Ruby version 2.
|
|
17
|
+
Requires Ruby version 2.5 or later
|
|
16
18
|
|
|
17
19
|
Built in instrumentation for:
|
|
18
20
|
|
data/RELEASING.md
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
# Releasing
|
|
2
2
|
|
|
3
|
-
- Update the version number in `lib/honeycomb/beeline/version`.
|
|
4
|
-
- Update `CHANGELOG.md` with the changes since the last release.
|
|
3
|
+
- Update the version number in `lib/honeycomb/beeline/version.rb`.
|
|
4
|
+
- Update `CHANGELOG.md` with the changes since the last release. Consider automating with a command such as these two:
|
|
5
|
+
- `git log $(git describe --tags --abbrev=0)..HEAD --no-merges --oneline > new-in-this-release.log`
|
|
6
|
+
- `git log --pretty='%C(green)%d%Creset- %s | %an'`
|
|
5
7
|
- Commit changes, push, and open a release preparation pull request for review.
|
|
6
8
|
- Once the pull request is merged, fetch the updated `main` branch.
|
|
7
|
-
- Apply a tag for the new version on the merged commit
|
|
8
|
-
- Push the
|
|
9
|
+
- Apply a tag for the new version on the merged commit (e.g. `git tag -a v2.3.1 -m "v2.3.1"`)
|
|
10
|
+
- Push the tag upstream (this will kick off the release pipeline in CI) e.g. `git push origin v2.3.1`
|
|
11
|
+
- Ensure that there is a draft GitHub release created as part of CI publish steps (this will also publish to Gems registry).
|
|
12
|
+
- Click "generate release notes" in GitHub for full changelog notes and any new contributors
|
|
9
13
|
- Publish the draft release in GitHub.
|
data/honeycomb-beeline.gemspec
CHANGED
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
|
15
15
|
|
|
16
16
|
spec.license = "Apache-2.0"
|
|
17
17
|
|
|
18
|
-
spec.required_ruby_version = ">= 2.
|
|
18
|
+
spec.required_ruby_version = ">= 2.5.0"
|
|
19
19
|
|
|
20
20
|
if spec.respond_to?(:metadata)
|
|
21
21
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
@@ -43,8 +43,8 @@ Gem::Specification.new do |spec|
|
|
|
43
43
|
spec.add_development_dependency "bump"
|
|
44
44
|
spec.add_development_dependency "bundler"
|
|
45
45
|
spec.add_development_dependency "overcommit", "~> 0.46.0"
|
|
46
|
-
spec.add_development_dependency "pry"
|
|
47
|
-
spec.add_development_dependency "pry-byebug"
|
|
46
|
+
spec.add_development_dependency "pry"
|
|
47
|
+
spec.add_development_dependency "pry-byebug"
|
|
48
48
|
spec.add_development_dependency "rake"
|
|
49
49
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
50
50
|
spec.add_development_dependency "rspec_junit_formatter", ">= 0.5.1"
|
|
@@ -52,9 +52,5 @@ Gem::Specification.new do |spec|
|
|
|
52
52
|
spec.add_development_dependency "rubocop-performance", "< 1.3.0"
|
|
53
53
|
spec.add_development_dependency "simplecov"
|
|
54
54
|
spec.add_development_dependency "simplecov-console"
|
|
55
|
-
|
|
56
|
-
spec.add_development_dependency "webmock", "< 3.15.0"
|
|
57
|
-
else
|
|
58
|
-
spec.add_development_dependency "webmock"
|
|
59
|
-
end
|
|
55
|
+
spec.add_development_dependency "webmock"
|
|
60
56
|
end
|
|
@@ -199,7 +199,7 @@ module Honeycomb
|
|
|
199
199
|
pretty.encode!("UTF-8", "binary", fallback: ->(c) { hex(c) })
|
|
200
200
|
pretty.gsub!(NEEDS_BACKSLASH, BACKSLASH)
|
|
201
201
|
pretty.gsub!(NEEDS_HEX) { |c| hex(c) }
|
|
202
|
-
pretty
|
|
202
|
+
NEEDS_QUOTES.match?(pretty) ? "\"#{pretty}\"" : pretty
|
|
203
203
|
end
|
|
204
204
|
|
|
205
205
|
# A regular expression matching characters that need to be hex-encoded.
|
|
@@ -52,10 +52,8 @@ module Honeycomb
|
|
|
52
52
|
module MarshalTraceContext
|
|
53
53
|
def to_trace_header
|
|
54
54
|
context = [""]
|
|
55
|
-
|
|
56
|
-
trace.fields
|
|
57
|
-
context.push("#{key}=#{trace.fields[key]}")
|
|
58
|
-
end
|
|
55
|
+
trace.fields.keys&.each do |key|
|
|
56
|
+
context.push("#{key}=#{trace.fields[key]}")
|
|
59
57
|
end
|
|
60
58
|
|
|
61
59
|
data_to_propagate = [
|
|
@@ -68,10 +66,8 @@ module Honeycomb
|
|
|
68
66
|
def self.to_trace_header(propagation_context)
|
|
69
67
|
context = [""]
|
|
70
68
|
fields = propagation_context.trace_fields
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
context.push("#{key}=#{fields[key]}")
|
|
74
|
-
end
|
|
69
|
+
fields.keys&.each do |key|
|
|
70
|
+
context.push("#{key}=#{fields[key]}")
|
|
75
71
|
end
|
|
76
72
|
|
|
77
73
|
data_to_propagate = [
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require "base64"
|
|
4
4
|
require "json"
|
|
5
5
|
require "uri"
|
|
6
|
+
require "libhoney/cleaner"
|
|
6
7
|
|
|
7
8
|
module Honeycomb
|
|
8
9
|
# Parsing and propagation for honeycomb trace headers
|
|
@@ -41,12 +42,10 @@ module Honeycomb
|
|
|
41
42
|
when "parent_id"
|
|
42
43
|
parent_span_id = value
|
|
43
44
|
when "context"
|
|
44
|
-
Base64.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
trace_fields = {}
|
|
49
|
-
end
|
|
45
|
+
Base64.urlsafe_decode64(value).tap do |json|
|
|
46
|
+
trace_fields = JSON.parse json
|
|
47
|
+
rescue JSON::ParserError
|
|
48
|
+
trace_fields = {}
|
|
50
49
|
end
|
|
51
50
|
end
|
|
52
51
|
end
|
|
@@ -60,14 +59,17 @@ module Honeycomb
|
|
|
60
59
|
|
|
61
60
|
# Serialize trace headers
|
|
62
61
|
module MarshalTraceContext
|
|
62
|
+
# for cleaning data in trace fields before serializing to prop header value
|
|
63
|
+
include Libhoney::Cleaner
|
|
64
|
+
# promote cleaner instance methods to module methods so that self.to_trace_header can use them
|
|
65
|
+
module_function :clean_data, :clean_string
|
|
66
|
+
|
|
63
67
|
def to_trace_header
|
|
64
|
-
context = Base64.urlsafe_encode64(JSON.generate(trace.fields)).strip
|
|
65
|
-
encoded_dataset = URI.encode_www_form_component(builder.dataset)
|
|
66
68
|
data_to_propogate = [
|
|
67
|
-
"dataset=#{
|
|
69
|
+
"dataset=#{encode_dataset(builder.dataset)}",
|
|
68
70
|
"trace_id=#{trace.id}",
|
|
69
71
|
"parent_id=#{id}",
|
|
70
|
-
"context=#{
|
|
72
|
+
"context=#{encode_trace_fields(trace.fields)}",
|
|
71
73
|
]
|
|
72
74
|
"1;#{data_to_propogate.join(',')}"
|
|
73
75
|
end
|
|
@@ -79,18 +81,28 @@ module Honeycomb
|
|
|
79
81
|
end
|
|
80
82
|
|
|
81
83
|
def self.to_trace_header(propagation_context)
|
|
82
|
-
fields = propagation_context.trace_fields
|
|
83
|
-
context = Base64.urlsafe_encode64(JSON.generate(fields)).strip
|
|
84
|
-
dataset = propagation_context.dataset
|
|
85
|
-
encoded_dataset = URI.encode_www_form_component(dataset)
|
|
86
84
|
data_to_propogate = [
|
|
87
|
-
"dataset=#{
|
|
85
|
+
"dataset=#{encode_dataset(propagation_context.dataset)}",
|
|
88
86
|
"trace_id=#{propagation_context.trace_id}",
|
|
89
87
|
"parent_id=#{propagation_context.parent_id}",
|
|
90
|
-
"context=#{
|
|
88
|
+
"context=#{encode_trace_fields(propagation_context.trace_fields)}",
|
|
91
89
|
]
|
|
92
90
|
"1;#{data_to_propogate.join(',')}"
|
|
93
91
|
end
|
|
92
|
+
|
|
93
|
+
def encode_trace_fields(fields)
|
|
94
|
+
Base64.urlsafe_encode64(
|
|
95
|
+
JSON.generate(
|
|
96
|
+
clean_data(fields),
|
|
97
|
+
),
|
|
98
|
+
).strip
|
|
99
|
+
end
|
|
100
|
+
module_function :encode_trace_fields
|
|
101
|
+
|
|
102
|
+
def encode_dataset(dataset)
|
|
103
|
+
URI.encode_www_form_component(dataset)
|
|
104
|
+
end
|
|
105
|
+
module_function :encode_dataset
|
|
94
106
|
end
|
|
95
107
|
end
|
|
96
108
|
end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require "base64"
|
|
4
4
|
require "json"
|
|
5
5
|
require "uri"
|
|
6
|
+
require "libhoney/cleaner"
|
|
6
7
|
|
|
7
8
|
module Honeycomb
|
|
8
9
|
# Parsing and propagation for honeycomb trace headers
|
|
@@ -39,12 +40,10 @@ module Honeycomb
|
|
|
39
40
|
when "parent_id"
|
|
40
41
|
parent_span_id = value
|
|
41
42
|
when "context"
|
|
42
|
-
Base64.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
trace_fields = {}
|
|
47
|
-
end
|
|
43
|
+
Base64.urlsafe_decode64(value).tap do |json|
|
|
44
|
+
trace_fields = JSON.parse json
|
|
45
|
+
rescue JSON::ParserError
|
|
46
|
+
trace_fields = {}
|
|
48
47
|
end
|
|
49
48
|
end
|
|
50
49
|
end
|
|
@@ -58,12 +57,16 @@ module Honeycomb
|
|
|
58
57
|
|
|
59
58
|
# Serialize trace headers
|
|
60
59
|
module MarshalTraceContext
|
|
60
|
+
# for cleaning data in trace fields before serializing to prop header value
|
|
61
|
+
include Libhoney::Cleaner
|
|
62
|
+
# promote cleaner instance methods to module methods so that self.to_trace_header can use them
|
|
63
|
+
module_function :clean_data, :clean_string
|
|
64
|
+
|
|
61
65
|
def to_trace_header
|
|
62
|
-
context = Base64.urlsafe_encode64(JSON.generate(trace.fields)).strip
|
|
63
66
|
data_to_propogate = [
|
|
64
67
|
"trace_id=#{trace.id}",
|
|
65
68
|
"parent_id=#{id}",
|
|
66
|
-
"context=#{
|
|
69
|
+
"context=#{encode_trace_fields(trace.fields)}",
|
|
67
70
|
]
|
|
68
71
|
"1;#{data_to_propogate.join(',')}"
|
|
69
72
|
end
|
|
@@ -75,15 +78,22 @@ module Honeycomb
|
|
|
75
78
|
end
|
|
76
79
|
|
|
77
80
|
def self.to_trace_header(propagation_context)
|
|
78
|
-
fields = propagation_context.trace_fields
|
|
79
|
-
context = Base64.urlsafe_encode64(JSON.generate(fields)).strip
|
|
80
81
|
data_to_propogate = [
|
|
81
82
|
"trace_id=#{propagation_context.trace_id}",
|
|
82
83
|
"parent_id=#{propagation_context.parent_id}",
|
|
83
|
-
"context=#{
|
|
84
|
+
"context=#{encode_trace_fields(propagation_context.trace_fields)}",
|
|
84
85
|
]
|
|
85
86
|
"1;#{data_to_propogate.join(',')}"
|
|
86
87
|
end
|
|
88
|
+
|
|
89
|
+
def encode_trace_fields(fields)
|
|
90
|
+
Base64.urlsafe_encode64(
|
|
91
|
+
JSON.generate(
|
|
92
|
+
clean_data(fields),
|
|
93
|
+
),
|
|
94
|
+
).strip
|
|
95
|
+
end
|
|
96
|
+
module_function :encode_trace_fields
|
|
87
97
|
end
|
|
88
98
|
end
|
|
89
99
|
end
|
|
@@ -5,8 +5,8 @@ module Honeycomb
|
|
|
5
5
|
module W3CPropagation
|
|
6
6
|
# Parse trace headers
|
|
7
7
|
module UnmarshalTraceContext
|
|
8
|
-
INVALID_TRACE_ID = "00000000000000000000000000000000"
|
|
9
|
-
INVALID_SPAN_ID = "0000000000000000"
|
|
8
|
+
INVALID_TRACE_ID = "00000000000000000000000000000000"
|
|
9
|
+
INVALID_SPAN_ID = "0000000000000000"
|
|
10
10
|
|
|
11
11
|
def parse_rack_env(env)
|
|
12
12
|
parse env["HTTP_TRACEPARENT"]
|
|
@@ -16,7 +16,7 @@ module Honeycomb
|
|
|
16
16
|
unless serialized_trace.nil?
|
|
17
17
|
version, payload = serialized_trace.split("-", 2)
|
|
18
18
|
# version should be 2 hex characters
|
|
19
|
-
if
|
|
19
|
+
if /^[A-Fa-f0-9]{2}$/.match?(version)
|
|
20
20
|
trace_id, parent_span_id = parse_v1(payload)
|
|
21
21
|
|
|
22
22
|
if !trace_id.nil? && !parent_span_id.nil?
|
data/lib/honeycomb/span.rb
CHANGED
|
@@ -149,13 +149,13 @@ module Honeycomb
|
|
|
149
149
|
end
|
|
150
150
|
|
|
151
151
|
if sample
|
|
152
|
-
presend_hook
|
|
152
|
+
presend_hook&.call(event.data)
|
|
153
153
|
event.send_presampled
|
|
154
154
|
end
|
|
155
155
|
@sent = true
|
|
156
156
|
context.span_sent(self)
|
|
157
157
|
|
|
158
|
-
parent
|
|
158
|
+
parent&.remove_child(self)
|
|
159
159
|
end
|
|
160
160
|
|
|
161
161
|
def add_additional_fields
|
data/lib/honeycomb-beeline.rb
CHANGED
|
@@ -40,10 +40,8 @@ module Honeycomb
|
|
|
40
40
|
|
|
41
41
|
def load_integrations
|
|
42
42
|
integrations_to_load.each do |integration|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
rescue LoadError
|
|
46
|
-
end
|
|
43
|
+
require "honeycomb/integrations/#{integration}"
|
|
44
|
+
rescue LoadError
|
|
47
45
|
end
|
|
48
46
|
end
|
|
49
47
|
|
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: 3.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Honeycomb.io Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-10-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: libhoney
|
|
@@ -84,30 +84,30 @@ dependencies:
|
|
|
84
84
|
name: pry
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
|
-
- - "
|
|
87
|
+
- - ">="
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: 0
|
|
89
|
+
version: '0'
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
|
-
- - "
|
|
94
|
+
- - ">="
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: 0
|
|
96
|
+
version: '0'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
98
|
name: pry-byebug
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
|
-
- - "
|
|
101
|
+
- - ">="
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version:
|
|
103
|
+
version: '0'
|
|
104
104
|
type: :development
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
|
-
- - "
|
|
108
|
+
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version:
|
|
110
|
+
version: '0'
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
112
|
name: rake
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -260,6 +260,7 @@ files:
|
|
|
260
260
|
- CODE_OF_CONDUCT.md
|
|
261
261
|
- CONTRIBUTING.md
|
|
262
262
|
- CONTRIBUTORS.md
|
|
263
|
+
- DEVELOPING.md
|
|
263
264
|
- Gemfile
|
|
264
265
|
- LICENSE
|
|
265
266
|
- NOTICE
|
|
@@ -317,14 +318,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
317
318
|
requirements:
|
|
318
319
|
- - ">="
|
|
319
320
|
- !ruby/object:Gem::Version
|
|
320
|
-
version: 2.
|
|
321
|
+
version: 2.5.0
|
|
321
322
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
322
323
|
requirements:
|
|
323
|
-
- - "
|
|
324
|
+
- - ">="
|
|
324
325
|
- !ruby/object:Gem::Version
|
|
325
|
-
version:
|
|
326
|
+
version: '0'
|
|
326
327
|
requirements: []
|
|
327
|
-
rubygems_version: 3.
|
|
328
|
+
rubygems_version: 3.4.10
|
|
328
329
|
signing_key:
|
|
329
330
|
specification_version: 4
|
|
330
331
|
summary: Instrument your Ruby apps with Honeycomb
|