honeycomb-beeline 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c117f411dfa05f94d94ae9d313afdc11e1f6c99395b64c4ba6cd5b064e0f5495
4
- data.tar.gz: 1379c608d00c04e6ab065f68710c77ce298f081336dbf0291585523343ef0ef1
3
+ metadata.gz: 6be26f3bc54561c09f8c6c35ab53586a71fd46cbff7a6d926c9e38b4246d9f49
4
+ data.tar.gz: bd9723d71f943492047ecad4c3634c54520346c6b3bd75a50bfb72498cffb339
5
5
  SHA512:
6
- metadata.gz: f018311206155ca7155cc737a04e8f72bfea03447647ae7688e834a99dc41a93d8045014e7cba6c1c337779feff9f07ad40301a82eccfe3c677e5868747701ac
7
- data.tar.gz: c653b95ca53f6aef8abbdc056d32cd51bf663b0e4960ae8d1d111b60f5f55adf63bd6e9ffbdb79bd8ead78dc399509006851c0f23df2263f550bfbb229b32a7d
6
+ metadata.gz: cd27f4f6844b6f691343e9fbdc2ea86b92a7a32e44005510d2e7d2270b0afa56a4ff1d7444608872f01cc053037a971d6c17a68d2548b3d3be34c327ed082989
7
+ data.tar.gz: fd2ce5459d4a2c2762d3c4caf625d120ae3fa15149ec288ee62c4d1eceb4b01618f66465e2e056684c1e2faebf4dceb1351364987c58e3a371ad037e879f262e
data/.circleci/config.yml CHANGED
@@ -132,10 +132,10 @@ jobs:
132
132
  path: coverage
133
133
 
134
134
  workflows:
135
- nightly:
135
+ weekly:
136
136
  triggers:
137
137
  - schedule:
138
- cron: "0 0 * * *"
138
+ cron: "0 0 * * 0"
139
139
  filters:
140
140
  branches:
141
141
  only:
data/.gitignore CHANGED
@@ -13,3 +13,6 @@
13
13
  .rspec_status
14
14
 
15
15
  /examples/**/*.lock
16
+
17
+ # intentionally omitting lock files
18
+ Gemfile.lock
data/.rubocop.yml CHANGED
@@ -36,11 +36,7 @@ Metrics/ParameterLists:
36
36
  Max: 6
37
37
 
38
38
  Style/AccessModifierDeclarations:
39
- Exclude:
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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
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
+
3
15
  ## 3.0.0 2023-06-08
4
16
 
5
17
  ### ⚠️ Breaking Changes ⚠️
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/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: vX.Y.Z, for example v1.1.2.
8
- - Push the new version tag up to the project repository to kick off build and artifact publishing to GitHub and the Gems registry.
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.
@@ -3,7 +3,7 @@
3
3
  module Honeycomb
4
4
  module Beeline
5
5
  NAME = "honeycomb-beeline"
6
- VERSION = "3.0.0"
6
+ VERSION = "3.0.1"
7
7
  USER_AGENT_SUFFIX = "#{NAME}/#{VERSION}"
8
8
  end
9
9
  end
@@ -20,10 +20,8 @@ module Honeycomb
20
20
  [nil, nil, nil, nil]
21
21
  end
22
22
  end
23
- # rubocop:disable Style/AccessModifierDeclarations
24
23
  module_function :parse_rack_env
25
24
  public :parse_rack_env
26
- # rubocop:enable Style/AccessModifierDeclarations
27
25
  end
28
26
  end
29
27
  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
@@ -41,7 +42,7 @@ module Honeycomb
41
42
  when "parent_id"
42
43
  parent_span_id = value
43
44
  when "context"
44
- Base64.decode64(value).tap do |json|
45
+ Base64.urlsafe_decode64(value).tap do |json|
45
46
  trace_fields = JSON.parse json
46
47
  rescue JSON::ParserError
47
48
  trace_fields = {}
@@ -58,14 +59,17 @@ module Honeycomb
58
59
 
59
60
  # Serialize trace headers
60
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
+
61
67
  def to_trace_header
62
- context = Base64.urlsafe_encode64(JSON.generate(trace.fields)).strip
63
- encoded_dataset = URI.encode_www_form_component(builder.dataset)
64
68
  data_to_propogate = [
65
- "dataset=#{encoded_dataset}",
69
+ "dataset=#{encode_dataset(builder.dataset)}",
66
70
  "trace_id=#{trace.id}",
67
71
  "parent_id=#{id}",
68
- "context=#{context}",
72
+ "context=#{encode_trace_fields(trace.fields)}",
69
73
  ]
70
74
  "1;#{data_to_propogate.join(',')}"
71
75
  end
@@ -77,18 +81,28 @@ module Honeycomb
77
81
  end
78
82
 
79
83
  def self.to_trace_header(propagation_context)
80
- fields = propagation_context.trace_fields
81
- context = Base64.urlsafe_encode64(JSON.generate(fields)).strip
82
- dataset = propagation_context.dataset
83
- encoded_dataset = URI.encode_www_form_component(dataset)
84
84
  data_to_propogate = [
85
- "dataset=#{encoded_dataset}",
85
+ "dataset=#{encode_dataset(propagation_context.dataset)}",
86
86
  "trace_id=#{propagation_context.trace_id}",
87
87
  "parent_id=#{propagation_context.parent_id}",
88
- "context=#{context}",
88
+ "context=#{encode_trace_fields(propagation_context.trace_fields)}",
89
89
  ]
90
90
  "1;#{data_to_propogate.join(',')}"
91
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
92
106
  end
93
107
  end
94
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,7 +40,7 @@ module Honeycomb
39
40
  when "parent_id"
40
41
  parent_span_id = value
41
42
  when "context"
42
- Base64.decode64(value).tap do |json|
43
+ Base64.urlsafe_decode64(value).tap do |json|
43
44
  trace_fields = JSON.parse json
44
45
  rescue JSON::ParserError
45
46
  trace_fields = {}
@@ -56,12 +57,16 @@ module Honeycomb
56
57
 
57
58
  # Serialize trace headers
58
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
+
59
65
  def to_trace_header
60
- context = Base64.urlsafe_encode64(JSON.generate(trace.fields)).strip
61
66
  data_to_propogate = [
62
67
  "trace_id=#{trace.id}",
63
68
  "parent_id=#{id}",
64
- "context=#{context}",
69
+ "context=#{encode_trace_fields(trace.fields)}",
65
70
  ]
66
71
  "1;#{data_to_propogate.join(',')}"
67
72
  end
@@ -73,15 +78,22 @@ module Honeycomb
73
78
  end
74
79
 
75
80
  def self.to_trace_header(propagation_context)
76
- fields = propagation_context.trace_fields
77
- context = Base64.urlsafe_encode64(JSON.generate(fields)).strip
78
81
  data_to_propogate = [
79
82
  "trace_id=#{propagation_context.trace_id}",
80
83
  "parent_id=#{propagation_context.parent_id}",
81
- "context=#{context}",
84
+ "context=#{encode_trace_fields(propagation_context.trace_fields)}",
82
85
  ]
83
86
  "1;#{data_to_propogate.join(',')}"
84
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
85
97
  end
86
98
  end
87
99
  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: 3.0.0
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-06-09 00:00:00.000000000 Z
11
+ date: 2023-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libhoney
@@ -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