diff --git a/processor/baggage/lib/opentelemetry/processor/baggage/baggage_span_processor.rb b/processor/baggage/lib/opentelemetry/processor/baggage/baggage_span_processor.rb index 59c5efeb54..0c30985733 100644 --- a/processor/baggage/lib/opentelemetry/processor/baggage/baggage_span_processor.rb +++ b/processor/baggage/lib/opentelemetry/processor/baggage/baggage_span_processor.rb @@ -9,6 +9,12 @@ module OpenTelemetry module Processor module Baggage + # Returns a text map propagator that propagates context in the XRay + # format. + def baggage_span_processor + BaggageSpanProcessor.new + end + # The BaggageSpanProcessor reads key/values stored in Baggage in the # starting span's parent context and adds them as attributes to the span. # @@ -41,6 +47,7 @@ module Baggage # ) # end class BaggageSpanProcessor + # Called when a {Span} is started, adds Baggage keys/values to the span as attributes. # # @param [Span] span the {Span} that just started, expected to conform diff --git a/processor/baggage/test/opentelemtry/processor/baggage/baggage_test.rb b/processor/baggage/test/opentelemtry/processor/baggage/baggage_test.rb new file mode 100644 index 0000000000..b38b9f7118 --- /dev/null +++ b/processor/baggage/test/opentelemtry/processor/baggage/baggage_test.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +# Copyright The OpenTelemetry Authors +# +# SPDX-License-Identifier: Apache-2.0 + +require 'test_helper' + +describe OpenTelemetry::Processor::Baggage do + describe '#baggage_processor' do + it 'returns an instance of BaggageProcessor' do + processor = OpenTelemetry::Processor::Baggage.baggage_span_processor + _(processor).must_be_instance_of( + OpenTelemetry::Processor::Baggage.BaggageSpanProcessor + ) + end + + # it 'adds baggage entries to the span' do + # ctx = OpenTelemetry::Baggage.set_value('testing_baggage', 'it_worked') + + # processor = OpenTelemetry::Processor::Baggage.baggage_processor + # span = OpenTelemetry::Trace::Span.new + # processor.process(span, ctx) + # end + end +end \ No newline at end of file diff --git a/processor/baggage/test/test_helper.rb b/processor/baggage/test/test_helper.rb new file mode 100644 index 0000000000..72adece2cc --- /dev/null +++ b/processor/baggage/test/test_helper.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# Copyright The OpenTelemetry Authors +# +# SPDX-License-Identifier: Apache-2.0 + +require 'minitest/autorun'