highlight_io 0.3.1 → 0.4.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: 8ac88fa49d586b18a7e1be34e4f2bbda4cdd574fcbeb83ffc97b75c0101d5b43
4
- data.tar.gz: 59840de16d8b5d3839c18aac425b7ea47aa76942a3ff4e539e8e2af623f1797b
3
+ metadata.gz: 92d68b8ab3821bca22f10aac336705ea4bb272f9a62572334715dbab501c5940
4
+ data.tar.gz: 9175f4a419f534ff297eb9ad907385a0dcf1b4e2366b738ceb438d947cef4876
5
5
  SHA512:
6
- metadata.gz: 834eeda394658f10de79c9102cb18415a0b2918030957a105cc6ba7505fe2e20d8ad63d28c4ca6ebe6dce7091207060343661c305a67844fc41c2cdc0e00446b
7
- data.tar.gz: 5723050e4cc62d07d4c53dfb6a1d34fb3771c622833643a0cacc7a5a5f6987ae432de560f16bb000e81631a8c8fdbad296cd79972811162a60dd303b2b1ad5ed
6
+ metadata.gz: 2c5032942516a6269fab88a89104cceba40b3279603a362142f12cd4340d080b5d484d3314f12076eb2e10c1e7fd8b9d24f7a6a21936665c827c0957139d5a2a
7
+ data.tar.gz: b89a5c22d6a8a9709c13831e535c38b68d3b10fdc48ca0577809978a57b65eccc374964632e7d0c3e8cf4feafe4f4c9676a6811b6d9ffdf2bedd5e2883023298
data/CHANGELOG.md CHANGED
@@ -19,3 +19,9 @@
19
19
  ## 0.2.2
20
20
 
21
21
  - Fix duplicate errors recorded on traces.
22
+
23
+ ## 0.4.0
24
+
25
+ - Add `H.init` alias
26
+ - Auto instrument Rails requests and eliminate need for `around_action`
27
+ - Fix warning about incompatibility with `ActiveSupport::LoggerSilence`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- highlight_io (0.3.1)
4
+ highlight_io (0.4.0)
5
5
  grpc (~> 1.65)
6
6
  opentelemetry-exporter-otlp (~> 0.28.1)
7
7
  opentelemetry-instrumentation-all (~> 0.62.1)
@@ -12,8 +12,8 @@ GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
14
  ast (2.4.2)
15
- google-protobuf (3.25.3-arm64-darwin)
16
- google-protobuf (3.25.3-x86_64-linux)
15
+ google-protobuf (3.25.4-arm64-darwin)
16
+ google-protobuf (3.25.4-x86_64-linux)
17
17
  googleapis-common-protos-types (1.15.0)
18
18
  google-protobuf (>= 3.18, < 5.a)
19
19
  grpc (1.65.2-arm64-darwin)
@@ -48,17 +48,17 @@ GEM
48
48
  opentelemetry-api (~> 1.0)
49
49
  opentelemetry-instrumentation-base (~> 0.22.1)
50
50
  opentelemetry-instrumentation-rack (~> 0.21)
51
- opentelemetry-instrumentation-action_view (0.7.1)
51
+ opentelemetry-instrumentation-action_view (0.7.2)
52
52
  opentelemetry-api (~> 1.0)
53
53
  opentelemetry-instrumentation-active_support (~> 0.1)
54
54
  opentelemetry-instrumentation-base (~> 0.22.1)
55
- opentelemetry-instrumentation-active_job (0.7.4)
55
+ opentelemetry-instrumentation-active_job (0.7.7)
56
56
  opentelemetry-api (~> 1.0)
57
57
  opentelemetry-instrumentation-base (~> 0.22.1)
58
58
  opentelemetry-instrumentation-active_model_serializers (0.20.2)
59
59
  opentelemetry-api (~> 1.0)
60
60
  opentelemetry-instrumentation-base (~> 0.22.1)
61
- opentelemetry-instrumentation-active_record (0.7.2)
61
+ opentelemetry-instrumentation-active_record (0.7.4)
62
62
  opentelemetry-api (~> 1.0)
63
63
  opentelemetry-instrumentation-base (~> 0.22.1)
64
64
  opentelemetry-instrumentation-active_support (0.6.0)
@@ -105,7 +105,7 @@ GEM
105
105
  opentelemetry-instrumentation-aws_sdk (0.5.4)
106
106
  opentelemetry-api (~> 1.0)
107
107
  opentelemetry-instrumentation-base (~> 0.22.1)
108
- opentelemetry-instrumentation-base (0.22.5)
108
+ opentelemetry-instrumentation-base (0.22.6)
109
109
  opentelemetry-api (~> 1.0)
110
110
  opentelemetry-common (~> 0.21)
111
111
  opentelemetry-registry (~> 0.1)
@@ -176,7 +176,7 @@ GEM
176
176
  opentelemetry-instrumentation-rack (0.24.6)
177
177
  opentelemetry-api (~> 1.0)
178
178
  opentelemetry-instrumentation-base (~> 0.22.1)
179
- opentelemetry-instrumentation-rails (0.31.1)
179
+ opentelemetry-instrumentation-rails (0.31.2)
180
180
  opentelemetry-api (~> 1.0)
181
181
  opentelemetry-instrumentation-action_mailer (~> 0.1.0)
182
182
  opentelemetry-instrumentation-action_pack (~> 0.9.0)
@@ -1,3 +1,3 @@
1
1
  module Highlight
2
- VERSION = '0.3.1'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
data/lib/highlight.rb CHANGED
@@ -18,6 +18,10 @@ module Highlight
18
18
  end
19
19
  end
20
20
 
21
+ def self.init(project_id, environment: '', otlp_endpoint: OTLP_HTTP, &block)
22
+ H.new(project_id, environment: environment, otlp_endpoint: otlp_endpoint, &block)
23
+ end
24
+
21
25
  def self.start_span(name, attrs = {}, &block)
22
26
  if block_given?
23
27
  H.instance.start_span(name, attrs, &block)
@@ -195,6 +199,8 @@ module Highlight
195
199
  end
196
200
 
197
201
  class Logger < ::Logger
202
+ include ActiveSupport::LoggerSilence if defined?(::ActiveSupport::LoggerSilence)
203
+
198
204
  def initialize(*args)
199
205
  super
200
206
  @local_level = nil
@@ -223,12 +229,18 @@ module Highlight
223
229
  def self.included(base)
224
230
  base.extend(ClassMethods)
225
231
  base.helper_method(:highlight_headers)
232
+ base.around_action(:with_highlight_context)
226
233
  end
227
234
 
228
235
  def with_highlight_context(&block)
229
236
  set_highlight_headers
230
- H.instance.trace(highlight_headers.session_id, highlight_headers.request_id,
231
- name: "#{request.method.upcase} #{request.path}", &block)
237
+
238
+ H.instance.trace(
239
+ highlight_headers.session_id,
240
+ highlight_headers.request_id,
241
+ name: "#{request.method.upcase} #{request.path}",
242
+ &block
243
+ )
232
244
  end
233
245
 
234
246
  private
@@ -285,4 +297,14 @@ module Highlight
285
297
  tag(:meta, name: 'traceparent', content: "00-#{hex_trace_id}-#{hex_span_id}-01")
286
298
  end
287
299
  end
300
+
301
+ if defined?(::Rails::Railtie)
302
+ class Railtie < ::Rails::Railtie
303
+ config.after_initialize do
304
+ ActiveSupport.on_load(:action_controller) do
305
+ include ::Highlight::Integrations::Rails
306
+ end
307
+ end
308
+ end
309
+ end
288
310
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: highlight_io
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Highlight
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-16 00:00:00.000000000 Z
11
+ date: 2024-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grpc