Skip to content

Commit

Permalink
add SW_APM_ENABLE_AFTER_FORK
Browse files Browse the repository at this point in the history
  • Loading branch information
xuan-cao-swi committed Nov 22, 2024
1 parent faaf5d6 commit a7eb6d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 0 additions & 1 deletion lib/oboe_metal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def start
# Send the report for the given event
#
def send_report(evt, with_system_timestamp: true)
report_init
SolarWindsAPM.reporter.sendReport(evt, with_system_timestamp)
end

Expand Down
9 changes: 8 additions & 1 deletion lib/solarwinds_apm/oboe_init_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def initialize
@metric_format = determine_the_metric_model
# log type (0 = stderr; 1 = stdout; 2 = file; 3 = null; 4 = disabled; default = 0)
@log_type = determine_oboe_log_type
# after fork enablement (0 = no after fork, only pre-fork; 1 = after fork enabled; default = 0)
@after_fork = determine_oboe_after_fork
end

# for testing with changed ENV vars
Expand Down Expand Up @@ -97,7 +99,8 @@ def array_for_oboe
@grpc_proxy, # 18
0, # 19 arg for lambda (no lambda for ruby yet)
@metric_format, # 20
@log_type # 21
@log_type, # 21
@after_fork # 22
]
end

Expand Down Expand Up @@ -211,5 +214,9 @@ def determine_lambda
true
end
end

def determine_oboe_after_fork
ENV['SW_APM_ENABLE_AFTER_FORK'].to_s == 'true' ? 1 : 0
end
end
end
2 changes: 2 additions & 0 deletions lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def on_finish(span)

return if non_entry_span(span: span)

SolarWindsAPM::Reporter.send(:report_init) # This only happens if after_fork enabled

span_time = calculate_span_time(start_time: span.start_timestamp, end_time: span.end_timestamp)
domain = nil
has_error = error?(span)
Expand Down

0 comments on commit a7eb6d2

Please sign in to comment.