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 +4 -4
- data/lib/foam/ruby/otel_setup.rb +17 -0
- data/lib/foam/ruby/version.rb +1 -1
- data/lib/foam/ruby.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e0cd5d2699e7c0780b212b06e4e272f4e3510253e64df195ebbee3868bc32257
|
|
4
|
+
data.tar.gz: 8a1625c3cd8c95898dc6f62cadc80af2a140e9b69671f542a2f2e1ed767b2aa6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2b2862bed64c2bf2d9b6776c5969ae9f4424564c37d8094f8515eb3696d4be22397a5c56cc56841a28fdefc97529dcc3fa311dfb348d932370b22bf3a36d869
|
|
7
|
+
data.tar.gz: eefce9a6236a601b986a50ccc6fc4a6b4bd9c79ffb2ea042078c472c8c1f99cf786b1ea21ab10bf970f90d93e05af0c4c8ac65ab104e5011c5f88c6546d5b5fc
|
data/lib/foam/ruby/otel_setup.rb
CHANGED
|
@@ -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,
|
data/lib/foam/ruby/version.rb
CHANGED
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
|
|