-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add_shoryuken_instrumentation
- Loading branch information
Showing
4 changed files
with
64 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
instrumentation/bunny/test/opentelemetry/instrumentation/bunny/patch_helpers_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright The OpenTelemetry Authors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
require_relative '../../../../lib/opentelemetry/instrumentation/bunny/patch_helpers' | ||
|
||
describe OpenTelemetry::Instrumentation::Bunny::PatchHelpers do | ||
let(:properties) do | ||
{ | ||
headers: { | ||
'traceparent' => '00-eab67ae26433f603121bd5674149d9e1-2007f3325d3cb6d6-01' | ||
}, | ||
tracer_receive_headers: { | ||
'traceparent' => '00-cd52775b3cb38931adf5fa880f890c25-cddb52a470027489-01' | ||
} | ||
} | ||
end | ||
|
||
describe '.extract_context' do | ||
it 'returns the parent context with links when headers from producer exists' do | ||
parent_context, links = OpenTelemetry::Instrumentation::Bunny::PatchHelpers.extract_context(properties) | ||
_(parent_context).must_be_instance_of(OpenTelemetry::Context) | ||
_(links).must_be_instance_of(Array) | ||
_(links.first).must_be_instance_of(OpenTelemetry::Trace::Link) | ||
end | ||
|
||
it 'returns the parent context with no links when headers from producer not present' do | ||
properties.delete(:headers) | ||
parent_context, links = OpenTelemetry::Instrumentation::Bunny::PatchHelpers.extract_context(properties) | ||
_(parent_context).must_be_instance_of(OpenTelemetry::Context) | ||
_(links).must_be_nil | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters