-
Notifications
You must be signed in to change notification settings - Fork 61
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
RUMM-2347: Provide core SDK context #988
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't it public by default ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, public
can be removed here
@@ -9,5 +9,9 @@ package com.datadog.android.v2.core.internal | |||
import com.datadog.android.v2.api.context.DatadogContext | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean like an async call ? Maybe we can provide both ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why doing the conversion and not have one single NetworkInfo
for both v1 and v2 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
DatadogContext
which includes some core SDK information, like service name, env, time information, device information, etc.Having
DatadogContext
allows to replaceuserInfoProvider
,timeProvider
,networkInfoProvider
,deviceInfoProvider
with it (currently replacement is done mostly in RUM, not everywhere).The data inside
DatadogContext
is 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)