Skip to content

Commit

Permalink
do not convert array to string
Browse files Browse the repository at this point in the history
  • Loading branch information
mabdinur committed Jul 15, 2024
1 parent 716f33a commit 08bb8c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions lib/datadog/tracing/span_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,7 @@ def initialize(

def to_hash
h = { name: @name, time_unix_nano: @time_unix_nano }
# stringify array values in attributes
unless @attributes.empty?
h[:attributes] = attributes&.map do |key, val|
val = val.to_s if val.is_a?(Array)
[key, val]
end.to_h
end

h[:attributes] = attributes unless @attributes.empty?
h
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/datadog/tracing/span_event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
let(:attributes) { { 'event.name' => 'test_event', 'event.id' => 1, 'nested' => [true, [2, 3], 'val'] } }
it {
is_expected.to include(
attributes: { 'event.name' => 'test_event', 'event.id' => 1, 'nested' => '[true, [2, 3], "val"]' }
attributes: attributes
)
}
end
Expand Down

0 comments on commit 08bb8c4

Please sign in to comment.