RUMM-486 Fix span encoding error on iOS versions prior to 13.0 #147
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What and why?
📦 Prior to
iOS13.0
the SDK was unable to send traces, asSpan
serialization was always failing. This PR fixes the behaviour oniOS11
andiOS12
.How?
As discussed in https://bugs.swift.org/browse/SR-6163, the
JSONEncoder
doesn't support primitive types encoding. This was fixed iniOS13
.We need primitive types encoding to make following part of Open Tracing interface compatible with Intake requirement: "all tags must be send as
String
values".As we can't fix
JSONEncoder
, a workaround was added - the tagvalue
is encoded as array and two surrounding bytes are removed from encodedData
. This is the fastest and most performant workaround that I found.Other things done in this PR
This PR is part of
RUMM-486
, so I made all production-code unit tests green oniOS11.1
,iOS12.4
andiOS13.5
. I hope this will be enough to automate tests execution on all supported platforms (coming in next PR).I've also discovered that
URLSessionSwizzlingTests
are failing prior toiOS13.0
. As this is uncompleted and non-public feature, I just disabled this tests temporary, so we can deliver working beta faster. This should be fixed in "tracing autoinstrumentation" scope.Review checklist