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

set geo.country_iso_code to user country #916

Merged
merged 17 commits into from
Sep 26, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.datadog.android.rum.RumErrorSource
import com.datadog.android.rum.RumMonitor
import com.datadog.android.rum.tracking.ActivityViewTrackingStrategy
import org.getlantern.lantern.LanternApp
import org.getlantern.lantern.BuildConfig
import org.getlantern.mobilesdk.Logger
import java.net.InetSocketAddress
import java.net.Proxy
Expand Down Expand Up @@ -52,8 +53,12 @@ object Datadog {
id = LanternApp.getSession().userId().toString(),
)

val monitor = RumMonitor.Builder().build()
GlobalRum.registerIfAbsent(monitor)
GlobalRum.registerIfAbsent {
RumMonitor.Builder().build()
}
val session = LanternApp.getSession()
val country = session.getCountryCode()
GlobalRum.addAttribute(GEO_COUNTRY_CODE, country)
atavism marked this conversation as resolved.
Show resolved Hide resolved
atavism marked this conversation as resolved.
Show resolved Hide resolved
initialized.set(true)
}

Expand Down Expand Up @@ -114,6 +119,7 @@ object Datadog {
.sampleRumSessions(100f)
.setUploadFrequency(UploadFrequency.FREQUENT)
.useSite(DatadogSite.EU1)
.trackBackgroundRumEvents(true)
.trackInteractions()
.trackLongTasks()
.setFirstPartyHosts(tracedHosts)
Expand All @@ -127,4 +133,5 @@ object Datadog {
}

private val TAG = Datadog::class.java.name
private const val GEO_COUNTRY_CODE = "geo.country_iso_code"
}