diff --git a/lib/solarwinds_apm/opentelemetry/otlp_processor.rb b/lib/solarwinds_apm/opentelemetry/otlp_processor.rb index d81b7bc..951c265 100644 --- a/lib/solarwinds_apm/opentelemetry/otlp_processor.rb +++ b/lib/solarwinds_apm/opentelemetry/otlp_processor.rb @@ -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 diff --git a/test/opentelemetry/otlp_processor_test.rb b/test/opentelemetry/otlp_processor_test.rb index df0050c..dcf1aa5 100644 --- a/test/opentelemetry/otlp_processor_test.rb +++ b/test/opentelemetry/otlp_processor_test.rb @@ -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 @@ -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) diff --git a/test/solarwinds_apm/oboe_metal_test.rb b/test/solarwinds_apm/oboe_metal_test.rb index d93be2c..ebdddb9 100644 --- a/test/solarwinds_apm/oboe_metal_test.rb +++ b/test/solarwinds_apm/oboe_metal_test.rb @@ -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