Skip to content

Commit

Permalink
Merge pull request #137 from solarwinds/lambda-response-mag
Browse files Browse the repository at this point in the history
Lambda response mag
  • Loading branch information
xuan-cao-swi authored Jul 17, 2024
2 parents f0bb138 + 76aa2ca commit c12fe2b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/solarwinds_apm/opentelemetry/otlp_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def init_metrics
def record_request_metrics(span)
meter_attrs = meter_attributes(span)
span_time = calculate_span_time(start_time: span.start_timestamp, end_time: span.end_timestamp)
span_time = (span_time / 1e3).round
SolarWindsAPM.logger.debug { "[#{self.class}/#{__method__}] entry span, response_time: #{span_time}." }
@metrics[:response_time].record(span_time, attributes: meter_attrs)
end
Expand Down
4 changes: 3 additions & 1 deletion test/opentelemetry/otlp_processor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

describe 'otlp processor test' do
before do
skip unless defined?(OpenTelemetry::SDK::Metrics)
skip unless defined?(OpenTelemetry::SDK::Metrics) # skip if no metrics_sdk loaded

@exporter = OpenTelemetry::Exporter::OTLP::Exporter.new
@txn_manager = SolarWindsAPM::TxnNameManager.new
Expand All @@ -28,10 +28,12 @@
@processor.instance_variable_get(:@meters)['sw.apm.sampling.metrics'].instance_variable_set(:@instrument_registry, {})
end

# Yellow ERROR due to missing metrics_sdk so far for testing otlp processor
it 'processor_meters_should_be_nil_at_beginning' do
_(@processor.instance_variable_get(:@metrics).size).must_equal 0
end

# Yellow ERROR due to missing metrics_sdk so far for testing otlp processor
it 'test_on_start_verfy_component_initialized_correctly' do
@processor.on_start(create_span, OpenTelemetry::Context.current)

Expand Down
4 changes: 4 additions & 0 deletions test/solarwinds_apm/oboe_metal_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ module SolarWindsAPM # rubocop:disable Lint/ConstantDefinitionInBlock
module Oboe_metal # rubocop:disable Naming/ClassAndModuleCamelCase
class Reporter
def initialize(*); end

def sendReport(*) # rubocop:disable Naming/MethodName
true
end
end
end
end
Expand Down

0 comments on commit c12fe2b

Please sign in to comment.