honeycomb-beeline 2.4.2 → 2.5.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: d99297b1c5e39a9a250cc298aac8282da89dc29247d2ea03567111f47001d14e
4
- data.tar.gz: 78233609ea887df63e5890476e8bae8b62e904db968f429d22c8562eaa62204e
3
+ metadata.gz: 8dfad7bddebd49b8645b61389e74035626a0cc817d5fc7ea9e51ab17cb571584
4
+ data.tar.gz: eadf7a28b41ddb6437e0e5a2c0824c2a2cf67fbf36a95bc18f77ad03b4f74306
5
5
  SHA512:
6
- metadata.gz: 4745aa8377bcd8fc7665431754d5e8e7f6ec067c8cb157d6ea463b8270b46b1fd87206432e2b8b0a68cbd3465914479c31dd185d2888087173da26f0cfa276fc
7
- data.tar.gz: 397aa8cd262415e7e1a83fb135b01e18d40a73f924a6526a7d4b5974cc9aef8e82a96906b0d6b8246cfcb45bcf474f5854f81c98766080cb29040736f3453f60
6
+ metadata.gz: 7c6204f46a27e4a3af3bf5d2d173fdb4d06f820ecf76dd2ed84d0de52aca83fb155190075b244ee6ab7e811c93927874ae51d36cc117b018de995ad5aeb76f40
7
+ data.tar.gz: 175c355b5a5833bfd68b17a281fc2d71f0321f7c708e339b03090b367d64d7a6c9294ed8afcc84d5f538b6c80644f9c26488475962903a2364bb6ab0e7ee93f8
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/integrations-team @martin308
5
+ * @honeycombio/telemetry-team @martin308
@@ -9,5 +9,7 @@ updates:
9
9
  directory: "/gemfiles/" # Location of package manifests
10
10
  schedule:
11
11
  interval: "weekly"
12
+ labels:
13
+ - "type: dependencies"
12
14
  reviewers:
13
- - "honeycombio/integrations-team"
15
+ - "honeycombio/telemetry-team"
@@ -0,0 +1,14 @@
1
+ name: Apply project management flow
2
+ on:
3
+ issues:
4
+ types: [opened]
5
+ pull_request_target:
6
+ types: [opened]
7
+ jobs:
8
+ project-management:
9
+ runs-on: ubuntu-latest
10
+ name: Apply project management flow
11
+ steps:
12
+ - uses: honeycombio/oss-management-actions/projects@v1
13
+ with:
14
+ ghprojects-token: ${{ secrets.GHPROJECTS_TOKEN }}
@@ -1,16 +1,10 @@
1
1
  name: Apply project labels
2
-
3
- on:
4
- - issues
5
- - label
6
- - pull_request_target
7
- - pull_request
8
-
2
+ on: [issues, pull_request, label]
9
3
  jobs:
10
4
  apply-labels:
11
5
  runs-on: ubuntu-latest
12
6
  name: Apply common project labels
13
7
  steps:
14
- - uses: honeycombio/integrations-labels@v1
8
+ - uses: honeycombio/oss-management-actions/labels@v1
15
9
  with:
16
10
  github-token: ${{ secrets.GITHUB_TOKEN }}
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.7.2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # beeline-ruby changelog
2
2
 
3
+ ## 2.5.0 2021-07-16
4
+
5
+ ### Added
6
+
7
+ - Allow backtrace to be sent with errors (#160) | [@lirossarvet](https://github.com/lirossarvet)
8
+
9
+ ### Maintenance
10
+
11
+ - Updates Github Action Workflows (#159) | [@bdarfler](https://github.com/bdarfler)
12
+ - Adds dependabot label (#158) | [@bdarfler](https://github.com/bdarfler)
13
+ - Switches CODEOWNERS to telemetry-team (#157) | [@bdarfler](https://github.com/bdarfler)
14
+
3
15
  ## 2.4.2 2021-06-25
4
16
 
5
17
  ### Fixes
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- honeycomb-beeline (2.4.2)
4
+ honeycomb-beeline (2.5.0)
5
5
  libhoney (~> 1.14, >= 1.14.2)
6
6
 
7
7
  GEM
@@ -3,7 +3,7 @@
3
3
  module Honeycomb
4
4
  module Beeline
5
5
  NAME = "honeycomb-beeline".freeze
6
- VERSION = "2.4.2".freeze
6
+ VERSION = "2.5.0".freeze
7
7
  USER_AGENT_SUFFIX = "#{NAME}/#{VERSION}".freeze
8
8
  end
9
9
  end
@@ -38,6 +38,7 @@ module Honeycomb
38
38
  parser_hook: configuration.http_trace_parser_hook,
39
39
  propagation_hook: configuration.http_trace_propagation_hook,
40
40
  }
41
+ @error_backtrace_limit = configuration.error_backtrace_limit.to_i
41
42
 
42
43
  configuration.after_initialize(self)
43
44
 
@@ -47,16 +48,7 @@ module Honeycomb
47
48
  end
48
49
 
49
50
  def start_span(name:, serialized_trace: nil, **fields)
50
- if context.current_trace.nil?
51
- Trace.new(serialized_trace: serialized_trace,
52
- builder: libhoney.builder,
53
- context: context,
54
- **@additional_trace_options)
55
- else
56
- context.current_span.create_child
57
- end
58
-
59
- current_span = context.current_span
51
+ current_span = new_span_for_context(serialized_trace: serialized_trace)
60
52
 
61
53
  fields.each do |key, value|
62
54
  current_span.add_field(key, value)
@@ -69,8 +61,8 @@ module Honeycomb
69
61
  begin
70
62
  yield current_span
71
63
  rescue StandardError => e
72
- current_span.add_field("error", e.class.name)
73
- current_span.add_field("error_detail", e.message)
64
+ add_exception_data(current_span, e)
65
+
74
66
  raise e
75
67
  ensure
76
68
  current_span.send
@@ -99,6 +91,39 @@ module Honeycomb
99
91
 
100
92
  private
101
93
 
102
- attr_reader :context
94
+ attr_reader :context, :error_backtrace_limit
95
+
96
+ def new_span_for_context(serialized_trace:)
97
+ if context.current_trace.nil?
98
+ Trace.new(
99
+ serialized_trace: serialized_trace,
100
+ builder: libhoney.builder,
101
+ context: context,
102
+ **@additional_trace_options,
103
+ )
104
+ else
105
+ context.current_span.create_child
106
+ end
107
+
108
+ context.current_span
109
+ end
110
+
111
+ def add_exception_data(span, exception)
112
+ span.add_field("error", exception.class.name)
113
+ span.add_field("error_detail", exception.message)
114
+
115
+ return if error_backtrace_limit <= 0
116
+
117
+ span.add_field(
118
+ "error_backtrace",
119
+ exception
120
+ .backtrace
121
+ .take(error_backtrace_limit)
122
+ .join("\n")
123
+ .encode("UTF-8", invalid: :replace, undef: :replace, replace: "�"),
124
+ )
125
+ span.add_field("error_backtrace_limit", error_backtrace_limit)
126
+ span.add_field("error_backtrace_total_length", exception.backtrace.length)
127
+ end
103
128
  end
104
129
  end
@@ -12,12 +12,14 @@ module Honeycomb
12
12
  :debug
13
13
 
14
14
  attr_writer :service_name, :client, :host_name
15
+ attr_reader :error_backtrace_limit
15
16
 
16
17
  def initialize
17
18
  @write_key = ENV["HONEYCOMB_WRITEKEY"]
18
19
  @dataset = ENV["HONEYCOMB_DATASET"]
19
20
  @service_name = ENV["HONEYCOMB_SERVICE"]
20
21
  @debug = ENV.key?("HONEYCOMB_DEBUG")
22
+ @error_backtrace_limit = 0
21
23
  @client = nil
22
24
  end
23
25
 
@@ -25,6 +27,10 @@ module Honeycomb
25
27
  @service_name || dataset
26
28
  end
27
29
 
30
+ def error_backtrace_limit=(val)
31
+ @error_backtrace_limit = Integer(val)
32
+ end
33
+
28
34
  def client
29
35
  options = {}.tap do |o|
30
36
  o[:writekey] = write_key
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: 2.4.2
4
+ version: 2.5.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: 2021-06-25 00:00:00.000000000 Z
11
+ date: 2021-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libhoney
@@ -253,12 +253,14 @@ files:
253
253
  - ".editorconfig"
254
254
  - ".github/CODEOWNERS"
255
255
  - ".github/dependabot.yml"
256
+ - ".github/workflows/add-to-project.yml"
256
257
  - ".github/workflows/apply-labels.yml"
257
258
  - ".gitignore"
258
259
  - ".overcommit.yml"
259
260
  - ".rspec"
260
261
  - ".rubocop.yml"
261
262
  - ".ruby-version"
263
+ - ".tool-versions"
262
264
  - Appraisals
263
265
  - CHANGELOG.md
264
266
  - CODE_OF_CONDUCT.md