diff --git a/CHANGELOG.md b/CHANGELOG.md index 134e2908..f14e1e97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,23 @@ https://github.com/solarwindscloud/solarwinds-apm-ruby/releases Dates in this file are in the format MM/DD/YYYY. + +# solarwinds_apm 6.0.0.preV3 (08/08/2023) + +This release includes the following features: + +* Updgraded liboboe version to 13.0.0 +* Rescue the sampler, processor and exporter without re-raise the error +* Marginlia for tracecontext in sql will work for activerecord > 7 with non-rails app (e.g. sinatra) +* Environmental variable name change: SOLARWINDS_APM_ENABLED -> SW_APM_ENABLED +* Updated lumberjack for tracecontext in logs +* Refactored test file structure based on folder `lib/` +* DB statement obfuscate for mysql2, pg and dalli will be default for opentelemetry-instrumentation +* Added otel.status and otel.description in span attributes +* Abandoned baggage to store root span; instea, using txn_manager +* Changed layer to span.kind:span.name +* Removed extensions from transaction_settings + # solarwinds_apm 6.0.0.preV2 (08/08/2023) This release includes the following features: diff --git a/lib/solarwinds_apm/api/opentelemetry.rb b/lib/solarwinds_apm/api/opentelemetry.rb index 35648b44..82ed702c 100644 --- a/lib/solarwinds_apm/api/opentelemetry.rb +++ b/lib/solarwinds_apm/api/opentelemetry.rb @@ -32,9 +32,7 @@ def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil, SolarWindsAPM.logger.debug {"[#{name}/#{__method__}] solarwinds_apm in_span with OTEL_SERVICE_NAME #{ENV['OTEL_SERVICE_NAME']}"} current_tracer = ::OpenTelemetry.tracer_provider.tracer(ENV['OTEL_SERVICE_NAME']) - current_tracer.in_span(name, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind) do |_span| - block.call - end + current_tracer.in_span(name, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind, &block) end end end diff --git a/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb b/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb index 37900760..8d25fcf0 100644 --- a/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +++ b/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb @@ -217,7 +217,7 @@ def create_xtraceoptions_response_value(liboboe_decision, parent_span_context, x # the sw.w3c.tracestate should perserve the old tracestate value for debugging purpose def calculate_attributes(attributes, liboboe_decision, trace_state, parent_span_context, xtraceoptions) SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] new_trace_state: #{trace_state.inspect}"} - new_attributes = attributes.dup + new_attributes = attributes.dup || {} # Always (root or is_remote) set _INTERNAL_SW_KEYS if injected new_attributes[INTERNAL_SW_KEYS] = xtraceoptions.sw_keys if xtraceoptions.sw_keys diff --git a/lib/solarwinds_apm/version.rb b/lib/solarwinds_apm/version.rb index c30ae30a..9c385078 100644 --- a/lib/solarwinds_apm/version.rb +++ b/lib/solarwinds_apm/version.rb @@ -9,7 +9,7 @@ module Version MAJOR = 6 # breaking, MINOR = 0 # feature, PATCH = 0 # fix => BFF - PRE = 'preV2'.freeze # for pre-releases into packagecloud, set to nil for production releases into rubygems + PRE = 'preV3'.freeze # for pre-releases into packagecloud, set to nil for production releases into rubygems STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.') end diff --git a/test/api/opentelemetry_inspan_test.rb b/test/api/opentelemetry_inspan_test.rb index 581e6824..27ca21ad 100644 --- a/test/api/opentelemetry_inspan_test.rb +++ b/test/api/opentelemetry_inspan_test.rb @@ -29,4 +29,24 @@ finished_spans = @in_memory_exporter.finished_spans _(finished_spans.first.name).must_equal 'custom_span' end + + it 'test_in_span_wrapper_from_solarwinds_apm_with_span' do + SolarWindsAPM::API.in_span('custom_span') do |span| + span.add_attributes({"test_attribute" => "attribute_1"}) + @op.call + end + + sleep 5 # give it some time to fetch from memory + + finished_spans = @in_memory_exporter.finished_spans + _(finished_spans.first.name).must_equal 'custom_span' + _(finished_spans.first.attributes['test_attribute']).must_equal 'attribute_1' + end + + it 'test_in_span_wrapper_from_solarwinds_apm_without_block' do + SolarWindsAPM::API.in_span('custom_span') + + finished_spans = @in_memory_exporter.finished_spans + _(finished_spans.size).must_equal 0 + end end