Skip to content

Commit

Permalink
Merge pull request #76 from solarwindscloud/prereleasev3
Browse files Browse the repository at this point in the history
prerelease 6.0.0.prev3
  • Loading branch information
xuan-cao-swi authored Sep 13, 2023
2 parents 23f94a5 + be0b719 commit 48239d4
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions lib/solarwinds_apm/api/opentelemetry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/solarwinds_apm/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions test/api/opentelemetry_inspan_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 48239d4

Please sign in to comment.