Skip to content

Commit

Permalink
add test files
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeGoldsmith committed Apr 22, 2024
1 parent 96a7d62 commit 90dee6f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions processor/baggage/test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

require 'minitest/autorun'

0 comments on commit 90dee6f

Please sign in to comment.