Skip to content

Commit a7eb6d2

Browse files
committed
add SW_APM_ENABLE_AFTER_FORK
1 parent faaf5d6 commit a7eb6d2

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

lib/oboe_metal.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ def start
5252
# Send the report for the given event
5353
#
5454
def send_report(evt, with_system_timestamp: true)
55-
report_init
5655
SolarWindsAPM.reporter.sendReport(evt, with_system_timestamp)
5756
end
5857

lib/solarwinds_apm/oboe_init_options.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def initialize
6767
@metric_format = determine_the_metric_model
6868
# log type (0 = stderr; 1 = stdout; 2 = file; 3 = null; 4 = disabled; default = 0)
6969
@log_type = determine_oboe_log_type
70+
# after fork enablement (0 = no after fork, only pre-fork; 1 = after fork enabled; default = 0)
71+
@after_fork = determine_oboe_after_fork
7072
end
7173

7274
# for testing with changed ENV vars
@@ -97,7 +99,8 @@ def array_for_oboe
9799
@grpc_proxy, # 18
98100
0, # 19 arg for lambda (no lambda for ruby yet)
99101
@metric_format, # 20
100-
@log_type # 21
102+
@log_type, # 21
103+
@after_fork # 22
101104
]
102105
end
103106

@@ -211,5 +214,9 @@ def determine_lambda
211214
true
212215
end
213216
end
217+
218+
def determine_oboe_after_fork
219+
ENV['SW_APM_ENABLE_AFTER_FORK'].to_s == 'true' ? 1 : 0
220+
end
214221
end
215222
end

lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def on_finish(span)
5151

5252
return if non_entry_span(span: span)
5353

54+
SolarWindsAPM::Reporter.send(:report_init) # This only happens if after_fork enabled
55+
5456
span_time = calculate_span_time(start_time: span.start_timestamp, end_time: span.end_timestamp)
5557
domain = nil
5658
has_error = error?(span)

0 commit comments

Comments
 (0)