RUMM-2347: Provide core SDK context#988
Conversation
8fcf7c2 to
da2dd64
Compare
Codecov Report
@@ Coverage Diff @@
## feature/sdkv2 #988 +/- ##
=================================================
+ Coverage 82.79% 82.91% +0.12%
=================================================
Files 295 295
Lines 9714 9823 +109
Branches 1590 1600 +10
=================================================
+ Hits 8042 8144 +102
- Misses 1190 1195 +5
- Partials 482 484 +2
|
| /** | ||
| * Device type. | ||
| */ | ||
| public enum class DeviceType { |
There was a problem hiding this comment.
indeed, public can be removed here
|
|
||
| internal interface ContextProvider { | ||
| val context: DatadogContext? | ||
| // TODO RUMM-0000 getting context may be quite heavy, should it be something non-blocking here? |
There was a problem hiding this comment.
You mean like an async call ? Maybe we can provide both ?
There was a problem hiding this comment.
We are currently not sure if we will expose core context provider as a part of public API. For internal needs we are ok with blocking call for now, considering the way we get context fields and what fields are added to the context, so keeping things simple for now.
| ) | ||
| } | ||
|
|
||
| private fun NetworkInfoV1.Connectivity.asV2(): NetworkInfo.Connectivity { |
There was a problem hiding this comment.
why doing the conversion and not have one single NetworkInfo for both v1 and v2 ?
There was a problem hiding this comment.
good point. The thing is that we indeed have some duplication for models between V1 and V2: UserInfo as well, for example. Eventually it will be only one, duplication is only for the V1 to V2 transition period, to have smaller changes footprint in PRs.
What does this PR do?
This change brings a complete
DatadogContextwhich includes some core SDK information, like service name, env, time information, device information, etc.Having
DatadogContextallows to replaceuserInfoProvider,timeProvider,networkInfoProvider,deviceInfoProviderwith it (currently replacement is done mostly in RUM, not everywhere).The data inside
DatadogContextis from the time the context was requested, there are no computed properties.NB: this change doesn't bring any thread-safety invariants or non-blocking API, those will be addresses later.
Reference in iOS repository DataDog/dd-sdk-ios#916.
Review checklist (to be filled by reviewers)