honeycomb-beeline 3.0.0 → 3.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c117f411dfa05f94d94ae9d313afdc11e1f6c99395b64c4ba6cd5b064e0f5495
4
- data.tar.gz: 1379c608d00c04e6ab065f68710c77ce298f081336dbf0291585523343ef0ef1
3
+ metadata.gz: '08af02ad5ff2f13cb62cb4e8fd2db744ef4c6300d47089c671db811c64088535'
4
+ data.tar.gz: 7f2367a5e51c0e4aec9ee8c6724b60cd7b97148960fbeec077c7b5fb46be9883
5
5
  SHA512:
6
- metadata.gz: f018311206155ca7155cc737a04e8f72bfea03447647ae7688e834a99dc41a93d8045014e7cba6c1c337779feff9f07ad40301a82eccfe3c677e5868747701ac
7
- data.tar.gz: c653b95ca53f6aef8abbdc056d32cd51bf663b0e4960ae8d1d111b60f5f55adf63bd6e9ffbdb79bd8ead78dc399509006851c0f23df2263f550bfbb229b32a7d
6
+ metadata.gz: 4ab8b1dd5cffe6067248ac5d1d5aaa1a1b66feb5b9f335d52cb48aa004c1b60af9857a172f9b729e4d753dbfe58b624ce90e33648afde210b66073fcddae9456
7
+ data.tar.gz: 6216d0c4eef4b5c20cb922d92e713c813f377a25542b2b7db26fb9553bab59bb34f573d66a35e324d68c22e23782482985a7618e02ee1c4d07462e8451d43415
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/.github/CODEOWNERS CHANGED
@@ -2,4 +2,4 @@
2
2
  # This file controls who is tagged for review for any given pull request.
3
3
 
4
4
  # For anything not explicitly taken by someone else:
5
- * @honeycombio/telemetry-team
5
+ * @honeycombio/pipeline-team
data/.github/release.yml CHANGED
@@ -18,6 +18,8 @@ changelog:
18
18
  - title: 🛠 Maintenance
19
19
  labels:
20
20
  - "type: maintenance"
21
+ - "type: dependencies"
22
+ - "type: documentation"
21
23
  - title: 🤷 Other Changes
22
24
  labels:
23
- - "*"
25
+ - "*"
@@ -11,5 +11,5 @@ jobs:
11
11
  steps:
12
12
  - uses: actions/add-to-project@main
13
13
  with:
14
- project-url: https://github.com/orgs/honeycombio/projects/11
14
+ project-url: https://github.com/orgs/honeycombio/projects/27
15
15
  github-token: ${{ secrets.GHPROJECTS_TOKEN }}
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,38 @@
1
1
  # beeline-ruby changelog
2
2
 
3
+ ## 3.1.0 2024-03-07
4
+
5
+ ⚠️ Minimum libhoney version is now 2.3.0 ⚠️
6
+
7
+ Previously the minimum libhoney was 1.14.2. Backwards-incompatible changes in [libhoney 2.0.0](https://github.com/honeycombio/libhoney-rb/releases/tag/v2.0.0):
8
+
9
+ * Removal of the deprecated Array input for http proxy configuration.
10
+ * If you are using the Beeline in services that must send web traffic through an out-going proxy, see [libhoney 1.x proxy_config deprecation warning](https://github.com/honeycombio/libhoney-rb/blob/v1.21.0/lib/libhoney/client.rb#L273-L276) for recommended configuration.
11
+ * Drop support for Ruby versions 2.2 and 2.3.
12
+ * Beeline Ruby already requires a minimum Ruby 2.5.
13
+
14
+ ### Enhancements
15
+
16
+ - feat: support classic ingest keys (#238) | Robb Kidd
17
+
18
+ ### Maintenance
19
+
20
+ - maint: add labels to release.yml for auto-generated grouping (#239) | Jamie Danielson
21
+ - maint: update codeowners to pipeline-team (#237) | Jamie Danielson
22
+ - maint: update codeowners to pipeline (#236) | Jamie Danielson
23
+
24
+ ## 3.0.1 2023-10-12
25
+
26
+ ### Fixed
27
+
28
+ - fix: clean invalid UTF8 from trace field values when generating propagation header (#232) | Robb Kidd
29
+
30
+ ### Maintenance
31
+
32
+ - maint: add local dev notes and fix example (#233) | Jamie Danielson
33
+ - ci: move nightly to weekly (#230) | Vera Reynolds
34
+ - ci: AWS specs updated to use include() instead of match() (#229) | Robb Kidd
35
+
3
36
  ## 3.0.0 2023-06-08
4
37
 
5
38
  ### ⚠️ 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.
@@ -37,7 +37,7 @@ 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.14.2"
40
+ spec.add_dependency "libhoney", ">= 2.3.0"
41
41
 
42
42
  spec.add_development_dependency "appraisal"
43
43
  spec.add_development_dependency "bump"
@@ -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.1.0"
7
7
  USER_AGENT_SUFFIX = "#{NAME}/#{VERSION}"
8
8
  end
9
9
  end
@@ -33,7 +33,7 @@ module Honeycomb
33
33
  @libhoney.add_field "service.name", configuration.service_name
34
34
  @context = Context.new
35
35
 
36
- @context.classic = classic_write_key?(configuration.write_key)
36
+ @context.classic = configuration.classic?
37
37
 
38
38
  @additional_trace_options = {
39
39
  presend_hook: configuration.presend_hook,
@@ -128,9 +128,5 @@ module Honeycomb
128
128
  span.add_field("error_backtrace_limit", error_backtrace_limit)
129
129
  span.add_field("error_backtrace_total_length", exception.backtrace.length)
130
130
  end
131
-
132
- def classic_write_key?(write_key)
133
- write_key.nil? || write_key.length == 32
134
- end
135
131
  end
136
132
  end
@@ -24,7 +24,7 @@ module Honeycomb
24
24
  end
25
25
 
26
26
  def classic?
27
- @write_key.nil? || @write_key.length == 32
27
+ Libhoney.classic_api_key?(@write_key)
28
28
  end
29
29
 
30
30
  def service_name
@@ -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.1.0
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: 2024-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libhoney
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.14.2
19
+ version: 2.3.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: 1.14.2
26
+ version: 2.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: appraisal
29
29
  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