Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Jaeger exporter with nil values #490

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions exporter/jaeger/lib/opentelemetry/exporter/jaeger/encoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ def encoded_process(resource)
end

def encoded_tags(attributes)
attributes&.map do |key, value|
encoded_tag(key, value)
end || EMPTY_ARRAY
if attributes
attributes.find_all { |_key, value| value }.map do |key, value|
encoded_tag(key, value)
end
else
EMPTY_ARRAY
end
end

def encoded_tag(key, value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@
)
end

it 'ignores nil values' do
attributes = { 'a_nil' => nil }
span_data = create_span_data(attributes: attributes)
encoded_span = Encoder.encoded_span(span_data)
_(encoded_span.tags.length).must_equal(0)
end


describe 'instrumentation library' do
it 'encodes library and version when set' do
lib = OpenTelemetry::SDK::InstrumentationLibrary.new('mylib', '0.1.0')
Expand Down