expo-observe 0.2.0 → 56.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/expo/modules/observe/Event.kt +35 -4
- package/android/src/main/java/expo/modules/observe/EventDispatcher.kt +2 -2
- package/android/src/main/java/expo/modules/observe/ObservabilityManager.kt +13 -4
- package/android/src/main/java/expo/modules/observe/ObserveModule.kt +30 -1
- package/android/src/main/java/expo/modules/observe/ObservePreferences.kt +23 -0
- package/android/src/main/java/expo/modules/observe/OpenTelemetry.kt +11 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +5 -0
- package/build/index.js.map +1 -1
- package/build/module.web.d.ts +4 -0
- package/build/module.web.d.ts.map +1 -1
- package/build/module.web.js +1 -0
- package/build/module.web.js.map +1 -1
- package/build/types.d.ts +11 -0
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/Event.swift +28 -2
- package/ios/ExpoObserve.podspec +2 -2
- package/ios/Observability.swift +151 -52
- package/ios/ObserveModule.swift +24 -2
- package/ios/ObserveUserDefaults.swift +36 -0
- package/ios/OpenTelemetry.swift +268 -9
- package/ios/Tests/OTAnyValueTests.swift +244 -0
- package/ios/Tests/ObservabilityTests.swift +76 -0
- package/ios/Tests/ObserveUserDefaultsTests.swift +48 -0
- package/ios/Tests/OpenTelemetryTests.swift +61 -6
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0-sources.jar +0 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0.aar +0 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/{0.2.0/expo.modules.observe-0.2.0.module → 56.0.0/expo.modules.observe-56.0.0.module} +40 -26
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0.module.md5 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/{0.2.0/expo.modules.observe-0.2.0.pom → 56.0.0/expo.modules.observe-56.0.0.pom} +16 -4
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/56.0.0/expo.modules.observe-56.0.0.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/maven-metadata.xml.sha512 +1 -1
- package/package.json +6 -6
- package/src/index.ts +7 -0
- package/src/module.web.ts +1 -0
- package/src/types.ts +8 -0
- package/tsconfig.json +1 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0-sources.jar +0 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0.aar +0 -0
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0.module.md5 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/observe/expo.modules.observe/0.2.0/expo.modules.observe-0.2.0.pom.sha512 +0 -1
|
@@ -3,6 +3,8 @@ package expo.modules.observe
|
|
|
3
3
|
import expo.modules.appmetrics.storage.Metric
|
|
4
4
|
import expo.modules.appmetrics.storage.Session
|
|
5
5
|
import kotlinx.serialization.Serializable
|
|
6
|
+
import kotlinx.serialization.builtins.MapSerializer
|
|
7
|
+
import kotlinx.serialization.builtins.serializer
|
|
6
8
|
import kotlinx.serialization.json.Json
|
|
7
9
|
import kotlinx.serialization.json.JsonObject
|
|
8
10
|
|
|
@@ -12,8 +14,8 @@ data class Metadata(
|
|
|
12
14
|
val appIdentifier: String,
|
|
13
15
|
val appVersion: String?,
|
|
14
16
|
val appBuildNumber: String?,
|
|
15
|
-
val appUpdateId: String?,
|
|
16
17
|
val appEasBuildId: String?,
|
|
18
|
+
val appUpdatesInfo: AppUpdatesInfo?,
|
|
17
19
|
val languageTag: String?,
|
|
18
20
|
val deviceOs: String?,
|
|
19
21
|
val deviceOsVersion: String?,
|
|
@@ -24,15 +26,43 @@ data class Metadata(
|
|
|
24
26
|
val clientVersion: String?,
|
|
25
27
|
val environment: String? = null
|
|
26
28
|
) {
|
|
29
|
+
@Serializable
|
|
30
|
+
data class AppUpdatesInfo(
|
|
31
|
+
val updateId: String?,
|
|
32
|
+
val runtimeVersion: String?,
|
|
33
|
+
val requestHeaders: Map<String, String>?
|
|
34
|
+
) {
|
|
35
|
+
val channel: String?
|
|
36
|
+
get() = requestHeaders?.get("expo-channel-name")
|
|
37
|
+
}
|
|
38
|
+
|
|
27
39
|
companion object {
|
|
28
|
-
fun fromSessionMetadata(session: Session): Metadata
|
|
29
|
-
|
|
40
|
+
fun fromSessionMetadata(session: Session): Metadata {
|
|
41
|
+
val appUpdatesInfo = if (
|
|
42
|
+
session.appUpdateId != null ||
|
|
43
|
+
session.appUpdateRuntimeVersion != null ||
|
|
44
|
+
session.appUpdateRequestHeaders != null
|
|
45
|
+
) {
|
|
46
|
+
val requestHeaders = session.appUpdateRequestHeaders?.let {
|
|
47
|
+
runCatching {
|
|
48
|
+
Json.decodeFromString(MapSerializer(String.serializer(), String.serializer()), it)
|
|
49
|
+
}.getOrNull()
|
|
50
|
+
}
|
|
51
|
+
AppUpdatesInfo(
|
|
52
|
+
updateId = session.appUpdateId,
|
|
53
|
+
runtimeVersion = session.appUpdateRuntimeVersion,
|
|
54
|
+
requestHeaders = requestHeaders
|
|
55
|
+
)
|
|
56
|
+
} else {
|
|
57
|
+
null
|
|
58
|
+
}
|
|
59
|
+
return Metadata(
|
|
30
60
|
appName = session.appName,
|
|
31
61
|
appIdentifier = session.appIdentifier ?: "",
|
|
32
62
|
appVersion = session.appVersion,
|
|
33
63
|
appBuildNumber = session.appBuildNumber,
|
|
34
|
-
appUpdateId = session.appUpdateId,
|
|
35
64
|
appEasBuildId = session.appEasBuildId,
|
|
65
|
+
appUpdatesInfo = appUpdatesInfo,
|
|
36
66
|
deviceOs = session.deviceOs,
|
|
37
67
|
deviceOsVersion = session.deviceOsVersion,
|
|
38
68
|
deviceModel = session.deviceModel,
|
|
@@ -43,6 +73,7 @@ data class Metadata(
|
|
|
43
73
|
languageTag = session.languageTag,
|
|
44
74
|
environment = session.environment
|
|
45
75
|
)
|
|
76
|
+
}
|
|
46
77
|
}
|
|
47
78
|
}
|
|
48
79
|
|
|
@@ -23,8 +23,8 @@ class EventDispatcher(
|
|
|
23
23
|
) {
|
|
24
24
|
private fun endpointUrl(): String {
|
|
25
25
|
val base = when (baseUrl.endsWith("/")) {
|
|
26
|
-
true -> "${baseUrl}$
|
|
27
|
-
else -> "$
|
|
26
|
+
true -> "${baseUrl}$projectId"
|
|
27
|
+
else -> "$baseUrl/$projectId"
|
|
28
28
|
}
|
|
29
29
|
return if (useOpenTelemetry) "$base/v1/metrics" else base
|
|
30
30
|
}
|
|
@@ -85,10 +85,7 @@ class BaseObservabilityManager(
|
|
|
85
85
|
return
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
val dispatchInDebug = ObservePreferences.getConfig(context)?.dispatchInDebug ?: false
|
|
90
|
-
val shouldDispatch = dispatchingEnabled && isInSample() && (!isDebugBuild || dispatchInDebug)
|
|
91
|
-
if (!shouldDispatch) {
|
|
88
|
+
if (!shouldDispatch()) {
|
|
92
89
|
pendingMetricsManager.removePendingMetrics(pendingIds)
|
|
93
90
|
return
|
|
94
91
|
}
|
|
@@ -125,6 +122,18 @@ class BaseObservabilityManager(
|
|
|
125
122
|
return deterministicUniformValueProvider() < clamped
|
|
126
123
|
}
|
|
127
124
|
|
|
125
|
+
private fun shouldDispatch(): Boolean {
|
|
126
|
+
val config = ObservePreferences.getConfig(context)
|
|
127
|
+
val dispatchingEnabled = config?.dispatchingEnabled ?: true
|
|
128
|
+
val dispatchInDebug = config?.dispatchInDebug ?: false
|
|
129
|
+
// `isDev` is the OR of the JS-bundle dev flag (pushed via `setBundleDefaults` on JS
|
|
130
|
+
// package import) and the native build's debug flag. Either being true means the
|
|
131
|
+
// bundle should be treated as dev for dispatch-gating.
|
|
132
|
+
val isJsDev = ObservePreferences.getBundleDefaults(context)?.isJsDev ?: false
|
|
133
|
+
val isDev = isDebugBuild || isJsDev
|
|
134
|
+
return dispatchingEnabled && isInSample() && (!isDev || dispatchInDebug)
|
|
135
|
+
}
|
|
136
|
+
|
|
128
137
|
suspend fun cleanup() {
|
|
129
138
|
pendingMetricsManager.cleanupOldPendingMetrics()
|
|
130
139
|
// TODO(@ubax): Move sessionManager.cleanupOldMetrics() out of eas observe
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package expo.modules.observe
|
|
2
2
|
|
|
3
3
|
import android.content.Context
|
|
4
|
+
import android.util.Log
|
|
4
5
|
import expo.modules.appmetrics.AppMetricsModule
|
|
5
6
|
import expo.modules.interfaces.constants.ConstantsInterface
|
|
6
7
|
import expo.modules.kotlin.exception.Exceptions
|
|
@@ -17,6 +18,11 @@ class Config(
|
|
|
17
18
|
@Field val sampleRate: Double? = null
|
|
18
19
|
) : Record
|
|
19
20
|
|
|
21
|
+
class BundleDefaults(
|
|
22
|
+
@Field val environment: String = "",
|
|
23
|
+
@Field val isJsDev: Boolean = false
|
|
24
|
+
) : Record
|
|
25
|
+
|
|
20
26
|
class ObserveModule : Module() {
|
|
21
27
|
private val context: Context
|
|
22
28
|
get() = appContext.reactContext ?: throw Exceptions.ReactContextLost()
|
|
@@ -55,7 +61,30 @@ class ObserveModule : Module() {
|
|
|
55
61
|
sampleRate = config.sampleRate
|
|
56
62
|
)
|
|
57
63
|
)
|
|
58
|
-
|
|
64
|
+
// Environment falls back to the bundle default (set on JS package import) so an
|
|
65
|
+
// omitted field becomes a deterministic value, not a silent retain of prior state.
|
|
66
|
+
val resolvedEnvironment = config.environment
|
|
67
|
+
?: ObservePreferences.getBundleDefaults(context)?.environment
|
|
68
|
+
resolvedEnvironment?.let { appMetricsModule.setEnvironment(it) }
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
Function("setBundleDefaults") { defaults: BundleDefaults ->
|
|
72
|
+
// Empty environment means JS bypassed both `process.env.NODE_ENV` and the
|
|
73
|
+
// `?? 'production'` fallback. Refuse rather than persist an empty string,
|
|
74
|
+
// which would silently corrupt downstream metrics.
|
|
75
|
+
if (defaults.environment.isEmpty()) {
|
|
76
|
+
Log.w(
|
|
77
|
+
OBSERVE_TAG,
|
|
78
|
+
"setBundleDefaults received empty environment; skipping. " +
|
|
79
|
+
"This is a bug in the JS layer — process.env.NODE_ENV should always resolve."
|
|
80
|
+
)
|
|
81
|
+
return@Function
|
|
82
|
+
}
|
|
83
|
+
ObservePreferences.setBundleDefaults(
|
|
84
|
+
context,
|
|
85
|
+
PersistedBundleDefaults(environment = defaults.environment, isJsDev = defaults.isJsDev)
|
|
86
|
+
)
|
|
87
|
+
appMetricsModule.setEnvironment(defaults.environment)
|
|
59
88
|
}
|
|
60
89
|
}
|
|
61
90
|
}
|
|
@@ -7,6 +7,7 @@ import kotlinx.serialization.json.Json
|
|
|
7
7
|
|
|
8
8
|
private const val PREFS_NAME = "dev.expo.observe"
|
|
9
9
|
private const val KEY_CONFIG = "config"
|
|
10
|
+
private const val KEY_BUNDLE_DEFAULTS = "bundleDefaults"
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Snapshot of the last `configure(...)` payload
|
|
@@ -18,6 +19,15 @@ data class PersistedConfig(
|
|
|
18
19
|
val sampleRate: Double? = null
|
|
19
20
|
)
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Bundle-derived facts pushed from the JS layer at package import time.
|
|
24
|
+
*/
|
|
25
|
+
@Serializable
|
|
26
|
+
data class PersistedBundleDefaults(
|
|
27
|
+
val environment: String,
|
|
28
|
+
val isJsDev: Boolean
|
|
29
|
+
)
|
|
30
|
+
|
|
21
31
|
object ObservePreferences {
|
|
22
32
|
fun getConfig(context: Context): PersistedConfig? {
|
|
23
33
|
val prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
|
@@ -31,4 +41,17 @@ object ObservePreferences {
|
|
|
31
41
|
putString(KEY_CONFIG, Json.encodeToString(config))
|
|
32
42
|
}
|
|
33
43
|
}
|
|
44
|
+
|
|
45
|
+
fun getBundleDefaults(context: Context): PersistedBundleDefaults? {
|
|
46
|
+
val prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
|
47
|
+
val json = prefs.getString(KEY_BUNDLE_DEFAULTS, null) ?: return null
|
|
48
|
+
return runCatching { Json.decodeFromString<PersistedBundleDefaults>(json) }.getOrNull()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
fun setBundleDefaults(context: Context, defaults: PersistedBundleDefaults) {
|
|
52
|
+
val prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
|
53
|
+
prefs.edit {
|
|
54
|
+
putString(KEY_BUNDLE_DEFAULTS, Json.encodeToString(defaults))
|
|
55
|
+
}
|
|
56
|
+
}
|
|
34
57
|
}
|
|
@@ -94,7 +94,7 @@ private val metricNameMap = mapOf(
|
|
|
94
94
|
"launchTime" to "expo.app_startup.launch_time",
|
|
95
95
|
|
|
96
96
|
// Updates
|
|
97
|
-
"updateDownloadTime" to "expo.updates.download_time"
|
|
97
|
+
"updateDownloadTime" to "expo.updates.download_time"
|
|
98
98
|
)
|
|
99
99
|
|
|
100
100
|
fun EASMetric.toOTMetric(): OTMetric {
|
|
@@ -134,7 +134,7 @@ fun Event.toOTMetadata(easClientId: String): OTMetadata {
|
|
|
134
134
|
OTAttribute.of("telemetry.sdk.language", "kotlin"),
|
|
135
135
|
OTAttribute.of("expo.sdk.version", metadata.expoSdkVersion),
|
|
136
136
|
OTAttribute.of("expo.react_native.version", metadata.reactNativeVersion),
|
|
137
|
-
OTAttribute.of("expo.eas_client.id", easClientId)
|
|
137
|
+
OTAttribute.of("expo.eas_client.id", easClientId)
|
|
138
138
|
)
|
|
139
139
|
|
|
140
140
|
// Send optional attributes only if they are set.
|
|
@@ -166,8 +166,16 @@ fun Event.toOTMetadata(easClientId: String): OTMetadata {
|
|
|
166
166
|
metadata.appBuildNumber?.let {
|
|
167
167
|
attributes.add(OTAttribute.of("expo.app.build_number", it))
|
|
168
168
|
}
|
|
169
|
-
metadata.
|
|
169
|
+
metadata.appUpdatesInfo?.updateId?.let {
|
|
170
|
+
// Fallback for backward compatibility
|
|
170
171
|
attributes.add(OTAttribute.of("expo.app.update_id", it))
|
|
172
|
+
attributes.add(OTAttribute.of("expo.app.updates.id", it))
|
|
173
|
+
}
|
|
174
|
+
metadata.appUpdatesInfo?.channel?.let {
|
|
175
|
+
attributes.add(OTAttribute.of("expo.app.updates.channel", it))
|
|
176
|
+
}
|
|
177
|
+
metadata.appUpdatesInfo?.runtimeVersion?.let {
|
|
178
|
+
attributes.add(OTAttribute.of("expo.app.updates.runtime_version", it))
|
|
171
179
|
}
|
|
172
180
|
metadata.environment?.let {
|
|
173
181
|
attributes.add(OTAttribute.of("expo.environment", it))
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOzE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,cAAc,SAAS,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import ExpoObserve from './module';
|
|
1
2
|
export { default as AppMetrics, AppMetricsRoot } from 'expo-app-metrics';
|
|
3
|
+
ExpoObserve.setBundleDefaults({
|
|
4
|
+
environment: process.env.NODE_ENV ?? 'production',
|
|
5
|
+
isJsDev: !!__DEV__,
|
|
6
|
+
});
|
|
2
7
|
export { default } from './module';
|
|
3
8
|
export * from './types';
|
|
4
9
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,cAAc,SAAS,CAAC","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEzE,WAAW,CAAC,iBAAiB,CAAC;IAC5B,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,YAAY;IACjD,OAAO,EAAE,CAAC,CAAC,OAAO;CACnB,CAAC,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,cAAc,SAAS,CAAC","sourcesContent":["import ExpoObserve from './module';\n\nexport { default as AppMetrics, AppMetricsRoot } from 'expo-app-metrics';\n\nExpoObserve.setBundleDefaults({\n environment: process.env.NODE_ENV ?? 'production',\n isJsDev: !!__DEV__,\n});\n\nexport { default } from './module';\nexport * from './types';\n"]}
|
package/build/module.web.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ export * from './types';
|
|
|
4
4
|
declare class ExpoObserveModule extends NativeModule implements ExpoObserveModuleType {
|
|
5
5
|
dispatchEvents(): Promise<void>;
|
|
6
6
|
configure(config: Config): void;
|
|
7
|
+
setBundleDefaults(defaults: {
|
|
8
|
+
environment: string;
|
|
9
|
+
isJsDev: boolean;
|
|
10
|
+
}): void;
|
|
7
11
|
}
|
|
8
12
|
declare const _default: typeof ExpoObserveModule;
|
|
9
13
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.web.d.ts","sourceRoot":"","sources":["../src/module.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,MAAM,CAAC;AAEvD,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE7D,cAAc,SAAS,CAAC;AAExB,cAAM,iBAAkB,SAAQ,YAAa,YAAW,qBAAqB;IACrE,cAAc;IACpB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"module.web.d.ts","sourceRoot":"","sources":["../src/module.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,MAAM,CAAC;AAEvD,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE7D,cAAc,SAAS,CAAC;AAExB,cAAM,iBAAkB,SAAQ,YAAa,YAAW,qBAAqB;IACrE,cAAc;IACpB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAC/B,iBAAiB,CAAC,QAAQ,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;CAC7E;;AAED,wBAAmE"}
|
package/build/module.web.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from './types';
|
|
|
3
3
|
class ExpoObserveModule extends NativeModule {
|
|
4
4
|
async dispatchEvents() { }
|
|
5
5
|
configure(config) { }
|
|
6
|
+
setBundleDefaults(defaults) { }
|
|
6
7
|
}
|
|
7
8
|
export default registerWebModule(ExpoObserveModule, 'ExpoObserve');
|
|
8
9
|
//# sourceMappingURL=module.web.js.map
|
package/build/module.web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.web.js","sourceRoot":"","sources":["../src/module.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAIvD,cAAc,SAAS,CAAC;AAExB,MAAM,iBAAkB,SAAQ,YAAY;IAC1C,KAAK,CAAC,cAAc,KAAI,CAAC;IACzB,SAAS,CAAC,MAAc,IAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"module.web.js","sourceRoot":"","sources":["../src/module.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAIvD,cAAc,SAAS,CAAC;AAExB,MAAM,iBAAkB,SAAQ,YAAY;IAC1C,KAAK,CAAC,cAAc,KAAI,CAAC;IACzB,SAAS,CAAC,MAAc,IAAS,CAAC;IAClC,iBAAiB,CAAC,QAAmD,IAAS,CAAC;CAChF;AAED,eAAe,iBAAiB,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import { NativeModule, registerWebModule } from 'expo';\n\nimport type { Config, ExpoObserveModuleType } from './types';\n\nexport * from './types';\n\nclass ExpoObserveModule extends NativeModule implements ExpoObserveModuleType {\n async dispatchEvents() {}\n configure(config: Config): void {}\n setBundleDefaults(defaults: { environment: string; isJsDev: boolean }): void {}\n}\n\nexport default registerWebModule(ExpoObserveModule, 'ExpoObserve');\n"]}
|
package/build/types.d.ts
CHANGED
|
@@ -52,5 +52,16 @@ export interface ExpoObserveModuleType {
|
|
|
52
52
|
* Configures observability settings.
|
|
53
53
|
*/
|
|
54
54
|
configure(config: Config): void;
|
|
55
|
+
/**
|
|
56
|
+
* Pushes JS-bundle-derived facts (`process.env.NODE_ENV`, `__DEV__`) into native
|
|
57
|
+
* storage. Called automatically once when the package is first imported; should
|
|
58
|
+
* not be called by host apps directly.
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
setBundleDefaults(defaults: {
|
|
63
|
+
environment: string;
|
|
64
|
+
isJsDev: boolean;
|
|
65
|
+
}): void;
|
|
55
66
|
}
|
|
56
67
|
//# sourceMappingURL=types.d.ts.map
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;;;;OAMG;IACH,iBAAiB,CAAC,QAAQ,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CAC9E"}
|
package/build/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type Config = {\n /**\n * The environment for observability events\n *\n * @default process.env.NODE_ENV\n */\n environment?: string;\n /**\n * Whether to dispatch observability events to the server.\n *\n * When `false`, any pending metrics are marked as sent without being dispatched\n * and no further metrics are dispatched until this is set back to `true`.\n *\n * @default true\n */\n dispatchingEnabled?: boolean;\n /**\n * Whether to dispatch metrics that were collected in a debug build of the host app.\n *\n * When `false`, metrics produced by debug builds are marked as sent without being dispatched.\n * When `true`, debug-build metrics are dispatched alongside release-build metrics.\n *\n * Has no effect on release builds.\n *\n * If `dispatchingEnabled` is `false` or this device is out-of-sample for `sampleRate`, nothing\n * is dispatched regardless of `dispatchInDebug`.\n *\n * @default false\n */\n dispatchInDebug?: boolean;\n /**\n * Fraction of installations that should dispatch metrics, in `[0, 1]`. Values outside that range\n * are clamped.\n *\n * The decision is **deterministic per installation** — a device is either permanently in-sample\n * or out-of-sample for a given rate, so the choice is stable across app launches.\n *\n * Interaction with `dispatchingEnabled`:\n * - If `dispatchingEnabled` is `false`, metrics are never dispatched\n * - If `dispatchingEnabled` is `true` (or unset), metrics are dispatched only when this device\n * is in-sample.\n *\n * > Note: Devices that end up out-of-sample drop pending metrics rather than accumulating them.\n *\n * @default undefined - metrics from all devices are sent\n */\n sampleRate?: number;\n};\n\nexport interface ExpoObserveModuleType {\n dispatchEvents(): Promise<void>;\n /**\n * Configures observability settings.\n */\n configure(config: Config): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type Config = {\n /**\n * The environment for observability events\n *\n * @default process.env.NODE_ENV\n */\n environment?: string;\n /**\n * Whether to dispatch observability events to the server.\n *\n * When `false`, any pending metrics are marked as sent without being dispatched\n * and no further metrics are dispatched until this is set back to `true`.\n *\n * @default true\n */\n dispatchingEnabled?: boolean;\n /**\n * Whether to dispatch metrics that were collected in a debug build of the host app.\n *\n * When `false`, metrics produced by debug builds are marked as sent without being dispatched.\n * When `true`, debug-build metrics are dispatched alongside release-build metrics.\n *\n * Has no effect on release builds.\n *\n * If `dispatchingEnabled` is `false` or this device is out-of-sample for `sampleRate`, nothing\n * is dispatched regardless of `dispatchInDebug`.\n *\n * @default false\n */\n dispatchInDebug?: boolean;\n /**\n * Fraction of installations that should dispatch metrics, in `[0, 1]`. Values outside that range\n * are clamped.\n *\n * The decision is **deterministic per installation** — a device is either permanently in-sample\n * or out-of-sample for a given rate, so the choice is stable across app launches.\n *\n * Interaction with `dispatchingEnabled`:\n * - If `dispatchingEnabled` is `false`, metrics are never dispatched\n * - If `dispatchingEnabled` is `true` (or unset), metrics are dispatched only when this device\n * is in-sample.\n *\n * > Note: Devices that end up out-of-sample drop pending metrics rather than accumulating them.\n *\n * @default undefined - metrics from all devices are sent\n */\n sampleRate?: number;\n};\n\nexport interface ExpoObserveModuleType {\n dispatchEvents(): Promise<void>;\n /**\n * Configures observability settings.\n */\n configure(config: Config): void;\n /**\n * Pushes JS-bundle-derived facts (`process.env.NODE_ENV`, `__DEV__`) into native\n * storage. Called automatically once when the package is first imported; should\n * not be called by host apps directly.\n *\n * @internal\n */\n setBundleDefaults(defaults: { environment: string; isJsDev: boolean }): void;\n}\n"]}
|
package/expo-module.config.json
CHANGED
package/ios/Event.swift
CHANGED
|
@@ -7,6 +7,7 @@ import ExpoAppMetrics
|
|
|
7
7
|
struct Event: Codable, Sendable {
|
|
8
8
|
let metadata: Metadata
|
|
9
9
|
let metrics: [Metric]
|
|
10
|
+
let logs: [Log]
|
|
10
11
|
|
|
11
12
|
struct Metadata: Codable, Sendable {
|
|
12
13
|
// AppInfo
|
|
@@ -14,8 +15,8 @@ struct Event: Codable, Sendable {
|
|
|
14
15
|
let appIdentifier: String?
|
|
15
16
|
let appVersion: String?
|
|
16
17
|
let appBuildNumber: String?
|
|
17
|
-
let appUpdateId: String?
|
|
18
18
|
let appEasBuildId: String?
|
|
19
|
+
let appUpdatesInfo: AppInfo.UpdatesInfo?
|
|
19
20
|
|
|
20
21
|
// DeviceInfo
|
|
21
22
|
let deviceName: String
|
|
@@ -50,6 +51,18 @@ struct Event: Codable, Sendable {
|
|
|
50
51
|
let customParams: AnyCodable?
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
struct Log: Codable, Sendable {
|
|
55
|
+
let name: String
|
|
56
|
+
let body: String?
|
|
57
|
+
let timestamp: String
|
|
58
|
+
let severity: Severity
|
|
59
|
+
let attributes: AnyCodable?
|
|
60
|
+
let droppedAttributesCount: Int
|
|
61
|
+
|
|
62
|
+
// Session
|
|
63
|
+
let sessionId: String
|
|
64
|
+
}
|
|
65
|
+
|
|
53
66
|
/**
|
|
54
67
|
Creates a new event for EAS, based on the objects from `expo-app-metrics` package.
|
|
55
68
|
*/
|
|
@@ -60,8 +73,8 @@ struct Event: Codable, Sendable {
|
|
|
60
73
|
appIdentifier: app.appId,
|
|
61
74
|
appVersion: app.appVersion,
|
|
62
75
|
appBuildNumber: app.buildNumber,
|
|
63
|
-
appUpdateId: app.updateId,
|
|
64
76
|
appEasBuildId: app.easBuildId,
|
|
77
|
+
appUpdatesInfo: app.updatesInfo,
|
|
65
78
|
|
|
66
79
|
deviceName: device.modelName,
|
|
67
80
|
deviceModel: device.modelIdentifier,
|
|
@@ -89,6 +102,19 @@ struct Event: Codable, Sendable {
|
|
|
89
102
|
customParams: metric.params
|
|
90
103
|
)
|
|
91
104
|
}
|
|
105
|
+
},
|
|
106
|
+
logs: sessions.flatMap { session in
|
|
107
|
+
return session.logs.map { log in
|
|
108
|
+
return Log(
|
|
109
|
+
name: log.name,
|
|
110
|
+
body: log.body,
|
|
111
|
+
timestamp: log.timestamp,
|
|
112
|
+
severity: log.severity,
|
|
113
|
+
attributes: log.attributes,
|
|
114
|
+
droppedAttributesCount: log.droppedAttributesCount,
|
|
115
|
+
sessionId: session.id
|
|
116
|
+
)
|
|
117
|
+
}
|
|
92
118
|
}
|
|
93
119
|
)
|
|
94
120
|
}
|
package/ios/ExpoObserve.podspec
CHANGED
|
@@ -11,8 +11,8 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.homepage = package['homepage']
|
|
13
13
|
s.platforms = {
|
|
14
|
-
:ios => '
|
|
15
|
-
:tvos => '
|
|
14
|
+
:ios => '16.4',
|
|
15
|
+
:tvos => '16.4'
|
|
16
16
|
}
|
|
17
17
|
s.swift_version = '6.0'
|
|
18
18
|
s.source = { git: 'https://github.com/expo/expo.git' }
|