foam-ruby 0.1.0.alpha10 → 0.1.0.alpha12

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: 71780521715f934380dd5f95a3a37dcb08f20080da5cd1c118323b436e96c2bb
4
- data.tar.gz: fac0121d3b535c4e36d75cedb35fe5e74fc0bbb286f8ed168485f8e2b20abd7b
3
+ metadata.gz: e0cd5d2699e7c0780b212b06e4e272f4e3510253e64df195ebbee3868bc32257
4
+ data.tar.gz: 8a1625c3cd8c95898dc6f62cadc80af2a140e9b69671f542a2f2e1ed767b2aa6
5
5
  SHA512:
6
- metadata.gz: 2b2e862134bc9f576ee91f1e7343af59ca31889392c959929f0bc8fcc931ea748b3b9f0796629eecf1bbd243f8927caacb456b0304b4bc1429bcd5e6493d0d3c
7
- data.tar.gz: 40d3e22371d54dad030036a5a552718b391c3112e7c114e49c5741e3c63906de62d459fb7bff0471be84f81fe6a795c35b7352613649f2e4362d54287ca285f5
6
+ metadata.gz: c2b2862bed64c2bf2d9b6776c5969ae9f4424564c37d8094f8515eb3696d4be22397a5c56cc56841a28fdefc97529dcc3fa311dfb348d932370b22bf3a36d869
7
+ data.tar.gz: eefce9a6236a601b986a50ccc6fc4a6b4bd9c79ffb2ea042078c472c8c1f99cf786b1ea21ab10bf970f90d93e05af0c4c8ac65ab104e5011c5f88c6546d5b5fc
@@ -9,6 +9,14 @@ require "opentelemetry-logs-sdk"
9
9
  module Foam
10
10
  module Ruby
11
11
  module OtelSetup
12
+ INSTRUMENTATIONS = %w[
13
+ opentelemetry-instrumentation-rack
14
+ opentelemetry-instrumentation-rails
15
+ opentelemetry-instrumentation-action_pack
16
+ opentelemetry-instrumentation-active_record
17
+ opentelemetry-instrumentation-active_support
18
+ ].freeze
19
+
12
20
  module_function
13
21
 
14
22
  def configure!(config)
@@ -16,7 +24,16 @@ module Foam
16
24
  configure_logs(config)
17
25
  end
18
26
 
27
+ def require_instrumentations!
28
+ INSTRUMENTATIONS.each do |gem_name|
29
+ require gem_name
30
+ rescue LoadError
31
+ nil
32
+ end
33
+ end
34
+
19
35
  def configure_traces(config)
36
+ require_instrumentations!
20
37
  @foam_span_processor = OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new(
21
38
  OpenTelemetry::Exporter::OTLP::Exporter.new(
22
39
  endpoint: config.traces_endpoint,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Foam
4
4
  module Ruby
5
- VERSION = "0.1.0.alpha10"
5
+ VERSION = "0.1.0.alpha12"
6
6
  end
7
7
  end
data/lib/foam/ruby.rb CHANGED
@@ -30,6 +30,7 @@ module Foam
30
30
 
31
31
  OtelSetup.configure!(config)
32
32
  insert_middleware!
33
+ schedule_logger_attach!
33
34
  bridge_sentry!
34
35
  @initialized = true
35
36
  rescue Exception => e # rubocop:disable Lint/RescueException
@@ -92,6 +93,14 @@ module Foam
92
93
  false
93
94
  end
94
95
 
96
+ def schedule_logger_attach!
97
+ return unless defined?(::Rails) && ::Rails.respond_to?(:application) && ::Rails.application
98
+
99
+ ::Rails.application.config.after_initialize { attach_otel_logger! }
100
+ rescue Exception # rubocop:disable Lint/RescueException
101
+ nil
102
+ end
103
+
95
104
  def insert_middleware!
96
105
  return unless defined?(::Rails) && ::Rails.respond_to?(:application) && ::Rails.application
97
106
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foam-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.alpha10
4
+ version: 0.1.0.alpha12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foam