expo-app-metrics 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.
Files changed (92) hide show
  1. package/android/src/main/java/expo/modules/appmetrics/AppMetadata.kt +11 -2
  2. package/android/src/main/java/expo/modules/appmetrics/AppMetadataProvider.kt +11 -7
  3. package/android/src/main/java/expo/modules/appmetrics/storage/MetricsDatabase.kt +4 -1
  4. package/android/src/main/java/expo/modules/appmetrics/storage/SessionManager.kt +8 -1
  5. package/android/src/main/java/expo/modules/appmetrics/updates/UpdatesMonitoring.kt +22 -16
  6. package/android/src/main/java/expo/modules/appmetrics/updates/UpdatesStateEvent.kt +1 -1
  7. package/build/AppMetricsRoot.d.ts +1 -1
  8. package/build/AppMetricsRoot.d.ts.map +1 -1
  9. package/build/AppMetricsRoot.js +3 -4
  10. package/build/AppMetricsRoot.js.map +1 -1
  11. package/build/module.d.ts +4 -0
  12. package/build/module.d.ts.map +1 -1
  13. package/build/module.web.d.ts +6 -2
  14. package/build/module.web.d.ts.map +1 -1
  15. package/build/module.web.js +7 -1
  16. package/build/module.web.js.map +1 -1
  17. package/build/types.d.ts +166 -0
  18. package/build/types.d.ts.map +1 -1
  19. package/build/types.js.map +1 -1
  20. package/expo-module.config.json +1 -1
  21. package/ios/AppMetrics.swift +17 -0
  22. package/ios/AppMetricsModule.swift +66 -2
  23. package/ios/CrashReporting/CrashReport.swift +228 -0
  24. package/ios/CrashReporting/CrashReportSimulation.swift +117 -0
  25. package/ios/CrashReporting/CrashReportSymbolicator.swift +200 -0
  26. package/ios/CrashReporting/CrashTriggers.swift +57 -0
  27. package/ios/ExpoAppMetrics.podspec +2 -2
  28. package/ios/LogEvents/AttributeValidation.swift +110 -0
  29. package/ios/LogEvents/EventBodyValidation.swift +34 -0
  30. package/ios/LogEvents/EventNameValidation.swift +42 -0
  31. package/ios/LogEvents/LogEventOptions.swift +14 -0
  32. package/ios/LogEvents/LogRecord.swift +39 -0
  33. package/ios/LogEvents/Severity.swift +39 -0
  34. package/ios/MetricKitSubscriber.swift +31 -32
  35. package/ios/MetricsReceiver.swift +9 -0
  36. package/ios/Sessions/MainSession.swift +46 -0
  37. package/ios/Sessions/Session.swift +25 -2
  38. package/ios/Storage/AppInfo.swift +22 -17
  39. package/ios/Storage/MetricsStorage.swift +15 -4
  40. package/ios/Tests/AttributeValidationTests.swift +139 -0
  41. package/ios/Tests/CrashReportSymbolicatorTests.swift +133 -0
  42. package/ios/Tests/CrashReportTests.swift +182 -0
  43. package/ios/Tests/EventBodyValidationTests.swift +45 -0
  44. package/ios/Tests/EventNameValidationTests.swift +50 -0
  45. package/ios/Tests/MetricsStorageTests.swift +5 -3
  46. package/ios/Updates/UpdatesMonitoring.swift +23 -14
  47. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/{0.2.0/expo.modules.appmetrics-0.2.0-sources.jar → 56.0.0/expo.modules.appmetrics-56.0.0-sources.jar} +0 -0
  48. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0-sources.jar.md5 +1 -0
  49. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0-sources.jar.sha1 +1 -0
  50. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0-sources.jar.sha256 +1 -0
  51. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0-sources.jar.sha512 +1 -0
  52. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0.aar +0 -0
  53. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0.aar.md5 +1 -0
  54. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0.aar.sha1 +1 -0
  55. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0.aar.sha256 +1 -0
  56. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0.aar.sha512 +1 -0
  57. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/{0.2.0/expo.modules.appmetrics-0.2.0.module → 56.0.0/expo.modules.appmetrics-56.0.0.module} +38 -24
  58. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0.module.md5 +1 -0
  59. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0.module.sha1 +1 -0
  60. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0.module.sha256 +1 -0
  61. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0.module.sha512 +1 -0
  62. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/{0.2.0/expo.modules.appmetrics-0.2.0.pom → 56.0.0/expo.modules.appmetrics-56.0.0.pom} +14 -2
  63. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0.pom.md5 +1 -0
  64. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0.pom.sha1 +1 -0
  65. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0.pom.sha256 +1 -0
  66. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/56.0.0/expo.modules.appmetrics-56.0.0.pom.sha512 +1 -0
  67. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/maven-metadata.xml +4 -4
  68. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/maven-metadata.xml.md5 +1 -1
  69. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/maven-metadata.xml.sha1 +1 -1
  70. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/maven-metadata.xml.sha256 +1 -1
  71. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/maven-metadata.xml.sha512 +1 -1
  72. package/package.json +5 -5
  73. package/src/module.web.ts +8 -2
  74. package/src/types.ts +191 -0
  75. package/tsconfig.json +1 -0
  76. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0-sources.jar.md5 +0 -1
  77. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0-sources.jar.sha1 +0 -1
  78. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0-sources.jar.sha256 +0 -1
  79. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0-sources.jar.sha512 +0 -1
  80. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0.aar +0 -0
  81. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0.aar.md5 +0 -1
  82. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0.aar.sha1 +0 -1
  83. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0.aar.sha256 +0 -1
  84. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0.aar.sha512 +0 -1
  85. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0.module.md5 +0 -1
  86. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0.module.sha1 +0 -1
  87. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0.module.sha256 +0 -1
  88. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0.module.sha512 +0 -1
  89. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0.pom.md5 +0 -1
  90. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0.pom.sha1 +0 -1
  91. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0.pom.sha256 +0 -1
  92. package/local-maven-repo/expo/modules/appmetrics/expo.modules.appmetrics/0.2.0/expo.modules.appmetrics-0.2.0.pom.sha512 +0 -1
@@ -5,7 +5,7 @@ data class AppMetadata(
5
5
  val appIdentifier: String,
6
6
  val appVersion: String?,
7
7
  val appBuildNumber: String?,
8
- val appUpdateId: String?,
8
+ val appUpdatesInfo: AppUpdatesInfo?,
9
9
  val appEasBuildId: String?,
10
10
  val languageTag: String?,
11
11
  val deviceOs: String?,
@@ -14,5 +14,14 @@ data class AppMetadata(
14
14
  val deviceName: String?,
15
15
  val expoSdkVersion: String,
16
16
  val reactNativeVersion: String,
17
- val clientVersion: String?,
17
+ val clientVersion: String?
18
18
  )
19
+
20
+ data class AppUpdatesInfo(
21
+ val updateId: String?,
22
+ val runtimeVersion: String?,
23
+ val requestHeaders: Map<String, String>?
24
+ ) {
25
+ val channel: String?
26
+ get() = requestHeaders?.get("expo-channel-name")
27
+ }
@@ -46,7 +46,7 @@ public object AppMetadataProvider {
46
46
  appIdentifier = context.packageName,
47
47
  appVersion = packageInfo.versionName,
48
48
  appBuildNumber = getAppBuildNumber(packageInfo),
49
- appUpdateId = getAppUpdateId(),
49
+ appUpdatesInfo = getAppUpdatesInfo(),
50
50
  appEasBuildId = BuildConfig.EXPO_EAS_BUILD_ID,
51
51
  languageTag = Locale.getDefault().getLanguageTag(),
52
52
  deviceOs = DEVICE_OS,
@@ -79,14 +79,18 @@ fun getAppBuildNumber(packageInfo: PackageInfo): String =
79
79
  packageInfo.versionCode.toString()
80
80
  }
81
81
 
82
- fun getAppUpdateId(): String? {
83
- val controller = UpdatesControllerRegistry.controller?.get() ?: return null
82
+ fun getAppUpdatesInfo(): AppUpdatesInfo {
83
+ val controller = UpdatesControllerRegistry.controller?.get()
84
+ ?: return AppUpdatesInfo(updateId = null, runtimeVersion = null, requestHeaders = null)
84
85
  val launchedUpdateId = controller.launchedUpdateId
85
86
  val embeddedUpdateId = controller.embeddedUpdateId
86
- if (launchedUpdateId == embeddedUpdateId) {
87
- return null
88
- }
89
- return launchedUpdateId?.toString()
87
+ // Ignore embedded launches – they are not available on the website anyway.
88
+ val updateId = if (launchedUpdateId == embeddedUpdateId) null else launchedUpdateId?.toString()
89
+ return AppUpdatesInfo(
90
+ updateId = updateId,
91
+ runtimeVersion = controller.runtimeVersion,
92
+ requestHeaders = controller.requestHeaders
93
+ )
90
94
  }
91
95
 
92
96
  fun getModelName(): String {
@@ -26,7 +26,7 @@ object MetricsConstants {
26
26
 
27
27
  @Database(
28
28
  entities = [Metric::class, Session::class],
29
- version = 11,
29
+ version = 13,
30
30
  exportSchema = false
31
31
  )
32
32
  abstract class MetricsDatabase : RoomDatabase() {
@@ -71,6 +71,9 @@ data class Session(
71
71
  @Field val appVersion: String? = null,
72
72
  @Field val appBuildNumber: String? = null,
73
73
  @Field val appUpdateId: String? = null,
74
+ @Field val appUpdateRuntimeVersion: String? = null,
75
+ // JSON-encoded Map<String, String> of update request headers
76
+ @Field val appUpdateRequestHeaders: String? = null,
74
77
  @Field val appEasBuildId: String? = null,
75
78
  // Device Info
76
79
  @Field val deviceOs: String? = null,
@@ -8,6 +8,9 @@ import expo.modules.appmetrics.AppMetricsPreferences
8
8
  import expo.modules.appmetrics.SQLITE_MAX_BIND_VARIABLES
9
9
  import expo.modules.appmetrics.TAG
10
10
  import expo.modules.appmetrics.utils.TimeUtils
11
+ import kotlinx.serialization.builtins.MapSerializer
12
+ import kotlinx.serialization.builtins.serializer
13
+ import kotlinx.serialization.json.Json
11
14
  import java.util.UUID
12
15
  import java.util.concurrent.CopyOnWriteArrayList
13
16
 
@@ -50,7 +53,11 @@ class SessionManager(
50
53
  appIdentifier = metadata?.appIdentifier,
51
54
  appVersion = metadata?.appVersion,
52
55
  appBuildNumber = metadata?.appBuildNumber,
53
- appUpdateId = metadata?.appUpdateId,
56
+ appUpdateId = metadata?.appUpdatesInfo?.updateId,
57
+ appUpdateRuntimeVersion = metadata?.appUpdatesInfo?.runtimeVersion,
58
+ appUpdateRequestHeaders = metadata?.appUpdatesInfo?.requestHeaders?.let {
59
+ Json.encodeToString(MapSerializer(String.serializer(), String.serializer()), it)
60
+ },
54
61
  appEasBuildId = metadata?.appEasBuildId,
55
62
  deviceOs = metadata?.deviceOs,
56
63
  deviceOsVersion = metadata?.deviceOsVersion,
@@ -1,6 +1,7 @@
1
1
  package expo.modules.appmetrics.updates
2
2
 
3
3
  import android.util.Log
4
+ import expo.modules.appmetrics.AppUpdatesInfo
4
5
  import expo.modules.appmetrics.MetricCategory
5
6
  import expo.modules.appmetrics.TAG
6
7
  import expo.modules.appmetrics.storage.Metric
@@ -18,28 +19,33 @@ class UpdatesMonitoring(
18
19
  ) {
19
20
 
20
21
  /**
21
- * Returns the launched OTA update ID, or null if the app was launched from the embedded bundle.
22
+ * Returns the current updates info (update ID, runtime version, request headers) for the
23
+ * launched app, or an empty info object when updates is not available.
22
24
  */
23
- fun getLaunchedUpdateId(): String? {
24
- val controller = UpdatesControllerRegistry.controller?.get() ?: return null
25
- val launchedUpdateId = controller.launchedUpdateId ?: return null
26
- val embeddedUpdateId = controller.embeddedUpdateId ?: return null
27
-
28
- // Ignore embedded launches
29
- if (launchedUpdateId == embeddedUpdateId) {
30
- return null
31
- }
32
- return launchedUpdateId.toString().lowercase()
25
+ fun getUpdatesMetricsInfo(): AppUpdatesInfo {
26
+ val controller = UpdatesControllerRegistry.controller?.get()
27
+ ?: return AppUpdatesInfo(updateId = null, runtimeVersion = null, requestHeaders = null)
28
+ val launchedUpdateId = controller.launchedUpdateId
29
+ val embeddedUpdateId = controller.embeddedUpdateId
30
+ // Ignore embedded launches – they are not available on the website anyway.
31
+ val updateId = if (launchedUpdateId == embeddedUpdateId) null else launchedUpdateId?.toString()?.lowercase()
32
+ return AppUpdatesInfo(
33
+ updateId = updateId,
34
+ runtimeVersion = controller.runtimeVersion,
35
+ requestHeaders = controller.requestHeaders
36
+ )
33
37
  }
34
38
 
35
39
  /**
36
- * Patches the app metadata with the OTA update ID if applicable.
40
+ * Patches the app metadata with the OTA updates info if applicable.
37
41
  */
38
42
  fun patchAppInfoIfNeeded(currentMetadata: expo.modules.appmetrics.AppMetadata?): expo.modules.appmetrics.AppMetadata? {
39
- val updateId = getLaunchedUpdateId() ?: return currentMetadata
40
- if (currentMetadata == null || currentMetadata.appUpdateId != null) return currentMetadata
41
- Log.d(TAG, "OTA update ID found, patching AppMetadata")
42
- return currentMetadata.copy(appUpdateId = updateId)
43
+ if (currentMetadata == null) return currentMetadata
44
+ val updatesInfo = getUpdatesMetricsInfo()
45
+ if (updatesInfo.updateId == null && updatesInfo.runtimeVersion == null) return currentMetadata
46
+ if (currentMetadata.appUpdatesInfo?.updateId != null) return currentMetadata
47
+ Log.d(TAG, "OTA update info found, patching AppMetadata")
48
+ return currentMetadata.copy(appUpdatesInfo = updatesInfo)
43
49
  }
44
50
 
45
51
  /**
@@ -18,7 +18,7 @@ data class UpdatesStateEvent(
18
18
  DownloadCompleteWithRollback("downloadCompleteWithRollback"),
19
19
  DownloadError("downloadError"),
20
20
  DownloadProgress("downloadProgress"),
21
- Restart("restart");
21
+ Restart("restart")
22
22
  }
23
23
 
24
24
  companion object {
@@ -6,7 +6,7 @@ import React from 'react';
6
6
  */
7
7
  export declare function AppMetricsRoot({ children }: {
8
8
  children: React.ReactNode;
9
- }): React.JSX.Element;
9
+ }): import("react/jsx-runtime").JSX.Element;
10
10
  export declare namespace AppMetricsRoot {
11
11
  var wrap: <P extends Record<string, unknown>>(Component: React.ComponentType<P>) => React.ComponentType<P>;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AppMetricsRoot.d.ts","sourceRoot":"","sources":["../src/AppMetricsRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAIzC;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAMzE;yBANe,cAAc;eAYM,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,aACxD,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAChC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"AppMetricsRoot.d.ts","sourceRoot":"","sources":["../src/AppMetricsRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAIzC;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAMzE;yBANe,cAAc;eAYM,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,aACxD,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAChC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
1
2
  import React, { useEffect } from 'react';
2
3
  import AppMetrics from './module';
3
4
  /**
@@ -9,16 +10,14 @@ export function AppMetricsRoot({ children }) {
9
10
  useEffect(() => {
10
11
  AppMetrics.markFirstRender();
11
12
  }, []);
12
- return <>{children}</>;
13
+ return _jsx(_Fragment, { children: children });
13
14
  }
14
15
  /**
15
16
  * Wraps a component with `AppMetricsRoot`.
16
17
  * Usage: `AppMetricsRoot.wrap(App);`
17
18
  */
18
19
  AppMetricsRoot.wrap = function wrap(Component) {
19
- const Wrapped = (props) => (<AppMetricsRoot>
20
- <Component {...props}/>
21
- </AppMetricsRoot>);
20
+ const Wrapped = (props) => (_jsx(AppMetricsRoot, { children: _jsx(Component, { ...props }) }));
22
21
  Wrapped.displayName = `AppMetricsRoot(${Component.displayName || Component.name || 'Component'})`;
23
22
  return Wrapped;
24
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AppMetricsRoot.js","sourceRoot":"","sources":["../src/AppMetricsRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,UAAU,MAAM,UAAU,CAAC;AAElC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAiC;IACxE,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,eAAe,EAAE,CAAC;IAC/B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;AACzB,CAAC;AAED;;;GAGG;AACH,cAAc,CAAC,IAAI,GAAG,SAAS,IAAI,CACjC,SAAiC;IAEjC,MAAM,OAAO,GAAG,CAAC,KAAQ,EAAE,EAAE,CAAC,CAC5B,CAAC,cAAc,CACb;MAAA,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,EACvB;IAAA,EAAE,cAAc,CAAC,CAClB,CAAC;IACF,OAAO,CAAC,WAAW,GAAG,kBAAkB,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,IAAI,WAAW,GAAG,CAAC;IAClG,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import React, { useEffect } from 'react';\n\nimport AppMetrics from './module';\n\n/**\n * A root component that automatically marks the first render.\n * Wrap your app's root component with this to measure time to first render\n * without manually calling `AppMetrics.markFirstRender()`.\n */\nexport function AppMetricsRoot({ children }: { children: React.ReactNode }) {\n useEffect(() => {\n AppMetrics.markFirstRender();\n }, []);\n\n return <>{children}</>;\n}\n\n/**\n * Wraps a component with `AppMetricsRoot`.\n * Usage: `AppMetricsRoot.wrap(App);`\n */\nAppMetricsRoot.wrap = function wrap<P extends Record<string, unknown>>(\n Component: React.ComponentType<P>\n): React.ComponentType<P> {\n const Wrapped = (props: P) => (\n <AppMetricsRoot>\n <Component {...props} />\n </AppMetricsRoot>\n );\n Wrapped.displayName = `AppMetricsRoot(${Component.displayName || Component.name || 'Component'})`;\n return Wrapped;\n};\n"]}
1
+ {"version":3,"file":"AppMetricsRoot.js","sourceRoot":"","sources":["../src/AppMetricsRoot.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,UAAU,MAAM,UAAU,CAAC;AAElC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAiC;IACxE,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,eAAe,EAAE,CAAC;IAC/B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,4BAAG,QAAQ,GAAI,CAAC;AACzB,CAAC;AAED;;;GAGG;AACH,cAAc,CAAC,IAAI,GAAG,SAAS,IAAI,CACjC,SAAiC;IAEjC,MAAM,OAAO,GAAG,CAAC,KAAQ,EAAE,EAAE,CAAC,CAC5B,KAAC,cAAc,cACb,KAAC,SAAS,OAAK,KAAK,GAAI,GACT,CAClB,CAAC;IACF,OAAO,CAAC,WAAW,GAAG,kBAAkB,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,IAAI,WAAW,GAAG,CAAC;IAClG,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import React, { useEffect } from 'react';\n\nimport AppMetrics from './module';\n\n/**\n * A root component that automatically marks the first render.\n * Wrap your app's root component with this to measure time to first render\n * without manually calling `AppMetrics.markFirstRender()`.\n */\nexport function AppMetricsRoot({ children }: { children: React.ReactNode }) {\n useEffect(() => {\n AppMetrics.markFirstRender();\n }, []);\n\n return <>{children}</>;\n}\n\n/**\n * Wraps a component with `AppMetricsRoot`.\n * Usage: `AppMetricsRoot.wrap(App);`\n */\nAppMetricsRoot.wrap = function wrap<P extends Record<string, unknown>>(\n Component: React.ComponentType<P>\n): React.ComponentType<P> {\n const Wrapped = (props: P) => (\n <AppMetricsRoot>\n <Component {...props} />\n </AppMetricsRoot>\n );\n Wrapped.displayName = `AppMetricsRoot(${Component.displayName || Component.name || 'Component'})`;\n return Wrapped;\n};\n"]}
package/build/module.d.ts CHANGED
@@ -2,8 +2,12 @@ import type { MetricAttributes } from './types';
2
2
  declare const _default: {
3
3
  markInteractive(attributes?: MetricAttributes): void;
4
4
  markFirstRender(): void;
5
+ logEvent(name: string, options?: import("./types").LogEventOptions): void;
5
6
  getStoredEntries(): Promise<import("./types").Metric[]>;
6
7
  clearStoredEntries(): Promise<void>;
8
+ getAllSessions(): Promise<import("./types").Session[]>;
9
+ simulateCrashReport(): void;
10
+ triggerCrash(kind: import("./types").CrashKind): void;
7
11
  startSession(): string;
8
12
  stopSession(sessionId: string): void;
9
13
  addCustomMetricToSession(sessionId: string, metric: {
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA4B,gBAAgB,EAAE,MAAM,SAAS,CAAC;;iCAQ3C,gBAAgB;;;;;;;;;;iBAU6qG,CAAC;cAAsB,CAAC;;;AAZpvG,wBAWE"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA4B,gBAAgB,EAAE,MAAM,SAAS,CAAC;;iCAQ3C,gBAAgB;;;;;;;;;;;;;;iBAUujR,CAAC;cAAsB,CAAC;;;AAZ9nR,wBAWE"}
@@ -1,5 +1,5 @@
1
1
  import { NativeModule } from 'expo';
2
- import type { ExpoAppMetricsModuleType, MetricAttributes } from './types';
2
+ import type { ExpoAppMetricsModuleType, LogEventOptions, MetricAttributes } from './types';
3
3
  export * from './types';
4
4
  declare class ExpoAppMetricsModule extends NativeModule implements ExpoAppMetricsModuleType {
5
5
  addCustomMetricToSession(sessionId: string, metric: {
@@ -8,9 +8,13 @@ declare class ExpoAppMetricsModule extends NativeModule implements ExpoAppMetric
8
8
  value: number;
9
9
  }): Promise<void>;
10
10
  markFirstRender(): Promise<void>;
11
- markInteractive(_attributes?: MetricAttributes): Promise<void>;
11
+ markInteractive(attributes?: MetricAttributes): Promise<void>;
12
+ logEvent(name: string, options?: LogEventOptions): void;
12
13
  getStoredEntries(): Promise<never[]>;
13
14
  clearStoredEntries(): Promise<void>;
15
+ getAllSessions(): Promise<never[]>;
16
+ simulateCrashReport(): void;
17
+ triggerCrash(): void;
14
18
  startSession(metadata?: string): string;
15
19
  stopSession(sessionId: string): void;
16
20
  }
@@ -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,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE1E,cAAc,SAAS,CAAC;AAExB,cAAM,oBAAqB,SAAQ,YAAa,YAAW,wBAAwB;IACjF,wBAAwB,CACtB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GACxD,OAAO,CAAC,IAAI,CAAC;IAGV,eAAe;IACf,eAAe,CAAC,WAAW,CAAC,EAAE,gBAAgB;IAC9C,gBAAgB;IAGhB,kBAAkB;IACxB,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM;IAG9B,WAAW,CAAC,SAAS,EAAE,MAAM;CAC9B;;AAED,wBAAyE"}
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,wBAAwB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3F,cAAc,SAAS,CAAC;AAExB,cAAM,oBAAqB,SAAQ,YAAa,YAAW,wBAAwB;IACjF,wBAAwB,CACtB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GACxD,OAAO,CAAC,IAAI,CAAC;IAGV,eAAe;IACf,eAAe,CAAC,UAAU,CAAC,EAAE,gBAAgB;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe;IAC1C,gBAAgB;IAGhB,kBAAkB;IAClB,cAAc;IAGpB,mBAAmB;IACnB,YAAY;IACZ,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM;IAG9B,WAAW,CAAC,SAAS,EAAE,MAAM;CAC9B;;AAED,wBAAyE"}
@@ -5,11 +5,17 @@ class ExpoAppMetricsModule extends NativeModule {
5
5
  throw new Error('Method not implemented.');
6
6
  }
7
7
  async markFirstRender() { }
8
- async markInteractive(_attributes) { }
8
+ async markInteractive(attributes) { }
9
+ logEvent(name, options) { }
9
10
  async getStoredEntries() {
10
11
  return [];
11
12
  }
12
13
  async clearStoredEntries() { }
14
+ async getAllSessions() {
15
+ return [];
16
+ }
17
+ simulateCrashReport() { }
18
+ triggerCrash() { }
13
19
  startSession(metadata) {
14
20
  return '';
15
21
  }
@@ -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,oBAAqB,SAAQ,YAAY;IAC7C,wBAAwB,CACtB,SAAiB,EACjB,MAAyD;QAEzD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,eAAe,KAAI,CAAC;IAC1B,KAAK,CAAC,eAAe,CAAC,WAA8B,IAAG,CAAC;IACxD,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,KAAK,CAAC,kBAAkB,KAAI,CAAC;IAC7B,YAAY,CAAC,QAAiB;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,WAAW,CAAC,SAAiB,IAAG,CAAC;CAClC;AAED,eAAe,iBAAiB,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { NativeModule, registerWebModule } from 'expo';\n\nimport type { ExpoAppMetricsModuleType, MetricAttributes } from './types';\n\nexport * from './types';\n\nclass ExpoAppMetricsModule extends NativeModule implements ExpoAppMetricsModuleType {\n addCustomMetricToSession(\n sessionId: string,\n metric: { category: string; name: string; value: number }\n ): Promise<void> {\n throw new Error('Method not implemented.');\n }\n async markFirstRender() {}\n async markInteractive(_attributes?: MetricAttributes) {}\n async getStoredEntries() {\n return [];\n }\n async clearStoredEntries() {}\n startSession(metadata?: string) {\n return '';\n }\n stopSession(sessionId: string) {}\n}\n\nexport default registerWebModule(ExpoAppMetricsModule, 'ExpoAppMetrics');\n"]}
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,oBAAqB,SAAQ,YAAY;IAC7C,wBAAwB,CACtB,SAAiB,EACjB,MAAyD;QAEzD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,eAAe,KAAI,CAAC;IAC1B,KAAK,CAAC,eAAe,CAAC,UAA6B,IAAG,CAAC;IACvD,QAAQ,CAAC,IAAY,EAAE,OAAyB,IAAG,CAAC;IACpD,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,KAAK,CAAC,kBAAkB,KAAI,CAAC;IAC7B,KAAK,CAAC,cAAc;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,mBAAmB,KAAI,CAAC;IACxB,YAAY,KAAI,CAAC;IACjB,YAAY,CAAC,QAAiB;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,WAAW,CAAC,SAAiB,IAAG,CAAC;CAClC;AAED,eAAe,iBAAiB,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { NativeModule, registerWebModule } from 'expo';\n\nimport type { ExpoAppMetricsModuleType, LogEventOptions, MetricAttributes } from './types';\n\nexport * from './types';\n\nclass ExpoAppMetricsModule extends NativeModule implements ExpoAppMetricsModuleType {\n addCustomMetricToSession(\n sessionId: string,\n metric: { category: string; name: string; value: number }\n ): Promise<void> {\n throw new Error('Method not implemented.');\n }\n async markFirstRender() {}\n async markInteractive(attributes?: MetricAttributes) {}\n logEvent(name: string, options?: LogEventOptions) {}\n async getStoredEntries() {\n return [];\n }\n async clearStoredEntries() {}\n async getAllSessions() {\n return [];\n }\n simulateCrashReport() {}\n triggerCrash() {}\n startSession(metadata?: string) {\n return '';\n }\n stopSession(sessionId: string) {}\n}\n\nexport default registerWebModule(ExpoAppMetricsModule, 'ExpoAppMetrics');\n"]}
package/build/types.d.ts CHANGED
@@ -107,11 +107,176 @@ export type MetricAttributes = {
107
107
  */
108
108
  params?: Record<string, unknown>;
109
109
  };
110
+ /**
111
+ * Severity of a log event, ordered from least to most severe:
112
+ *
113
+ * - `"trace"` — Fine-grained tracing, typically only useful while reproducing
114
+ * a specific issue.
115
+ * - `"debug"` — Diagnostic detail useful during development; usually filtered
116
+ * out in production.
117
+ * - `"info"` — Routine, expected events that record normal app behavior.
118
+ * - `"warn"` — Unexpected but recoverable conditions worth investigating.
119
+ * - `"error"` — An operation failed; the app continues running but is in a
120
+ * degraded state.
121
+ * - `"fatal"` — A severe failure, often immediately followed by app termination.
122
+ */
123
+ export type LogSeverity = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
124
+ /**
125
+ * Value types accepted in a log event's `attributes` map. Strings, numbers,
126
+ * and booleans are stored as typed primitives; arrays and nested maps preserve
127
+ * their structure. Other JS values (functions, `Date`, `undefined`, etc.) are
128
+ * not supported and may be dropped by downstream consumers.
129
+ */
130
+ export type LogAttributeValue = string | number | boolean | LogAttributeValue[] | {
131
+ [key: string]: LogAttributeValue;
132
+ };
133
+ /**
134
+ * A single log event collected during a session.
135
+ */
136
+ export type LogRecord = {
137
+ /**
138
+ * ISO 8601 timestamp of when the record was created.
139
+ */
140
+ timestamp: string;
141
+ /**
142
+ * Event name.
143
+ */
144
+ name: string;
145
+ /**
146
+ * Optional free-form message describing the event.
147
+ */
148
+ body?: string | null;
149
+ /**
150
+ * Custom attributes attached to the event. Each entry is preserved with its
151
+ * original value type — see `LogAttributeValue` for the supported shapes.
152
+ */
153
+ attributes?: Record<string, LogAttributeValue> | null;
154
+ /**
155
+ * Severity of the event.
156
+ */
157
+ severity: LogSeverity;
158
+ };
159
+ /**
160
+ * Optional configuration accepted by `logEvent`. The event name is passed as
161
+ * the first positional argument since it's required and the only field most
162
+ * callers set.
163
+ */
164
+ export type LogEventOptions = {
165
+ /**
166
+ * Optional free-form message describing the event.
167
+ */
168
+ body?: string | null;
169
+ /**
170
+ * Custom attributes attached to the event. Each entry is preserved with its
171
+ * original value type — see `LogAttributeValue` for the supported shapes.
172
+ */
173
+ attributes?: Record<string, LogAttributeValue> | null;
174
+ /**
175
+ * Severity of the event.
176
+ *
177
+ * @default "info"
178
+ */
179
+ severity?: LogSeverity | null;
180
+ };
181
+ export type SessionType = 'main' | 'foreground' | 'screen' | 'custom' | 'unknown';
182
+ export type CrashKind = 'badAccess' | 'fatalError' | 'divideByZero' | 'forceUnwrapNil' | 'arrayOutOfBounds' | 'objcException' | 'stackOverflow';
183
+ type SessionBase = {
184
+ id: string;
185
+ startDate: string;
186
+ endDate?: string | null;
187
+ metrics: Metric[];
188
+ logs: LogRecord[];
189
+ };
190
+ export type MainSession = SessionBase & {
191
+ type: 'main';
192
+ crashReport?: CrashReport | null;
193
+ };
194
+ export type GenericSession = SessionBase & {
195
+ type: Exclude<SessionType, 'main'>;
196
+ };
197
+ export type Session = MainSession | GenericSession;
198
+ export type CallStackFrame = {
199
+ binaryName?: string | null;
200
+ binaryUUID?: string | null;
201
+ address?: number | null;
202
+ offsetIntoBinaryTextSegment?: number | null;
203
+ sampleCount?: number | null;
204
+ subFrames?: CallStackFrame[] | null;
205
+ /**
206
+ * Resolved symbol from on-device `dladdr` symbolication. Swift and Itanium-ABI C++
207
+ * names are demangled; Objective-C selectors and plain C symbols are returned as-is.
208
+ * `null` when the binary is not loaded in this process or `dladdr` could not resolve it.
209
+ *
210
+ * @platform ios
211
+ */
212
+ symbol?: string | null;
213
+ };
214
+ export type CallStack = {
215
+ threadAttributed?: boolean | null;
216
+ callStackRootFrames?: CallStackFrame[] | null;
217
+ };
218
+ export type CallStackTree = {
219
+ callStacks?: CallStack[] | null;
220
+ };
221
+ export type CrashReport = {
222
+ exceptionType?: number | null;
223
+ exceptionCode?: number | null;
224
+ signal?: number | null;
225
+ terminationReason?: string | null;
226
+ virtualMemoryRegionInfo?: string | null;
227
+ exceptionReason?: {
228
+ composedMessage: string;
229
+ formatString: string;
230
+ arguments: string[];
231
+ exceptionType: string;
232
+ className: string;
233
+ exceptionName: string;
234
+ } | null;
235
+ callStackTree?: CallStackTree | null;
236
+ timestampBegin: string;
237
+ timestampEnd: string;
238
+ ingestedAt: string;
239
+ };
110
240
  export interface ExpoAppMetricsModuleType {
111
241
  markFirstRender(): void;
112
242
  markInteractive(attributes?: MetricAttributes): void;
243
+ /**
244
+ * Records a log event against the current main session. The event is
245
+ * persisted locally and dispatched on the next `dispatchEvents()` flush as an
246
+ * OpenTelemetry log record sent to the `/v1/logs` endpoint.
247
+ *
248
+ * Severity defaults to `"info"` when not provided.
249
+ *
250
+ * @param name Event name. Maps to the OpenTelemetry `event.name` attribute.
251
+ * @param options Optional body, attributes, and severity overrides.
252
+ */
253
+ logEvent(name: string, options?: LogEventOptions): void;
113
254
  getStoredEntries(): Promise<Metric[]>;
114
255
  clearStoredEntries(): Promise<void>;
256
+ /**
257
+ * Returns all sessions across the current and historical entries,
258
+ * ordered with the current launch first.
259
+ *
260
+ * @private This API is unstable and may change without notice.
261
+ * @platform ios
262
+ */
263
+ getAllSessions(): Promise<Session[]>;
264
+ /**
265
+ * Simulates a crash report, attributing it to the current main session.
266
+ * Intended for development and debugging only.
267
+ *
268
+ * @private This API is unstable and may change without notice.
269
+ * @platform ios
270
+ */
271
+ simulateCrashReport(): void;
272
+ /**
273
+ * Intentionally crashes the app to produce a real MetricKit diagnostic.
274
+ * Intended for development and debugging only.
275
+ *
276
+ * @private This API is unstable and may change without notice.
277
+ * @platform ios
278
+ */
279
+ triggerCrash(kind: CrashKind): void;
115
280
  /**
116
281
  * Starts a new app metrics session. Returns the session ID.
117
282
  *
@@ -135,4 +300,5 @@ export interface ExpoAppMetricsModuleType {
135
300
  params?: Record<string, unknown>;
136
301
  }): Promise<void>;
137
302
  }
303
+ export {};
138
304
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH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I,CAAC;IACT,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,eAAe,IAAI,IAAI,CAAC;IACxB,eAAe,CAAC,UAAU,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACrD;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IACxD,gBAAgB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACtC,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC;;;;;;OAMG;IACH,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAErC;;;;;;OAMG;IACH,mBAAmB,IAAI,IAAI,CAAC;IAE5B;;;;;;OAMG;IACH,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IAEpC;;;;OAIG;IACH,YAAY,IAAI,MAAM,CAAC;IACvB;;;;OAIG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC;;OAEG;IACH,wBAAwB,CACtB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAClC,GACA,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type AppStartupTimes = {\n /**\n * Time from when the user taps the app to the moment the app starts executing the main code.\n * It includes loading native dynamic libraries, executing C++ static constructors\n * and Objective-C `+load` methods defined in classes or categories.\n *\n * @platform iOS\n */\n loadTime?: number;\n /**\n * Full time from process start until the root view of the React Native instance is created,\n * recorded when the app is launched fresh by the user.\n */\n coldLaunchTime?: number;\n /**\n * Launch time recorded when the process was already running in the background\n * before the user launches the app.\n */\n warmLaunchTime?: number;\n /**\n * Duration to evaluate the JavaScript bundle by the runtime.\n */\n bundleLoadTime?: number;\n /**\n * Time until the first React render occurs.\n */\n timeToFirstRender?: number;\n /**\n * Time until the app is interactive (after first render).\n */\n timeToInteractive?: number;\n};\n\nexport type MemoryUsageSnapshot = {\n /**\n * Memory in bytes allocated by the app, including both the physical memory and additional memory that the app might be using,\n * such as memory that has been paged out (swapped) to disk or memory that is shared with other processes.\n *\n * @platform iOS\n */\n allocated?: number;\n /**\n * Physical memory in bytes pages currently in use (resident size).\n */\n physical: number;\n /**\n * The amount of available memory in bytes that app can still allocate.\n */\n available: number;\n /**\n * The amount of memory in bytes currently used by the Java heap.\n *\n * @platform android\n */\n javaHeap?: number;\n};\n\nexport type FrameRateMetrics = {\n /**\n * Total amount of frames rendered.\n */\n renderedFrames: number;\n /**\n * Expected amount of frames rendered if everything renders without any delay.\n */\n expectedFrames: number;\n /**\n * Number of frames which were skipped because the main thread was busy with some work.\n */\n droppedFrames: number;\n /**\n * Total amount of frozen frames. Frozen frame is frame that takes at least 700ms to render.\n * It is a term from [Android development](https://developer.android.com/topic/performance/vitals/frozen).\n */\n frozenFrames: number;\n /**\n * Total amount of slow frames. Slow frame is frame that takes at least 17ms to render.\n * It is a term from [Android development](https://developer.android.com/topic/performance/vitals/render).\n */\n slowFrames: number;\n /**\n * Total amount of freeze durations, in seconds. Freeze is an amount of time every frame rendering was delayed by in comparison with the ideal performant frame.\n * For example if expected frame duration was 16ms, but in reality we've rendered this frame in 320ms, we have a freeze with 304ms duration.\n */\n freezeTime: number;\n /**\n * Total duration of the screen session, in seconds. It is counted by summing up all rendered frames duration.\n */\n sessionDuration: number;\n};\n\nexport interface Metric {\n timestamp: string;\n category: string;\n name: string;\n value: number;\n sessionId: string;\n routeName?: string;\n params?: Record<string, unknown>;\n}\n\nexport type MetricAttributes = {\n /**\n * Name of the route associated with the metric. Some metrics populate this\n * with a sensible default when omitted — for example, the TTI metric falls\n * back to the initial route name detected from the router.\n */\n routeName?: string;\n /**\n * Custom parameters to attach to the metric.\n */\n params?: Record<string, unknown>;\n};\n\nexport interface ExpoAppMetricsModuleType {\n markFirstRender(): void;\n markInteractive(attributes?: MetricAttributes): void;\n getStoredEntries(): Promise<Metric[]>;\n clearStoredEntries(): Promise<void>;\n\n /**\n * Starts a new app metrics session. Returns the session ID.\n *\n * @platform android\n */\n startSession(): string;\n /**\n * Stops the app metrics session with the given session ID.\n *\n * @platform android\n */\n stopSession(sessionId: string): void;\n /**\n * @platform android\n */\n addCustomMetricToSession(\n sessionId: string,\n metric: {\n category: string;\n name: string;\n value: number;\n routeName?: string;\n params?: Record<string, unknown>;\n }\n ): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type AppStartupTimes = {\n /**\n * Time from when the user taps the app to the moment the app starts executing the main code.\n * It includes loading native dynamic libraries, executing C++ static constructors\n * and Objective-C `+load` methods defined in classes or categories.\n *\n * @platform iOS\n */\n loadTime?: number;\n /**\n * Full time from process start until the root view of the React Native instance is created,\n * recorded when the app is launched fresh by the user.\n */\n coldLaunchTime?: number;\n /**\n * Launch time recorded when the process was already running in the background\n * before the user launches the app.\n */\n warmLaunchTime?: number;\n /**\n * Duration to evaluate the JavaScript bundle by the runtime.\n */\n bundleLoadTime?: number;\n /**\n * Time until the first React render occurs.\n */\n timeToFirstRender?: number;\n /**\n * Time until the app is interactive (after first render).\n */\n timeToInteractive?: number;\n};\n\nexport type MemoryUsageSnapshot = {\n /**\n * Memory in bytes allocated by the app, including both the physical memory and additional memory that the app might be using,\n * such as memory that has been paged out (swapped) to disk or memory that is shared with other processes.\n *\n * @platform iOS\n */\n allocated?: number;\n /**\n * Physical memory in bytes pages currently in use (resident size).\n */\n physical: number;\n /**\n * The amount of available memory in bytes that app can still allocate.\n */\n available: number;\n /**\n * The amount of memory in bytes currently used by the Java heap.\n *\n * @platform android\n */\n javaHeap?: number;\n};\n\nexport type FrameRateMetrics = {\n /**\n * Total amount of frames rendered.\n */\n renderedFrames: number;\n /**\n * Expected amount of frames rendered if everything renders without any delay.\n */\n expectedFrames: number;\n /**\n * Number of frames which were skipped because the main thread was busy with some work.\n */\n droppedFrames: number;\n /**\n * Total amount of frozen frames. Frozen frame is frame that takes at least 700ms to render.\n * It is a term from [Android development](https://developer.android.com/topic/performance/vitals/frozen).\n */\n frozenFrames: number;\n /**\n * Total amount of slow frames. Slow frame is frame that takes at least 17ms to render.\n * It is a term from [Android development](https://developer.android.com/topic/performance/vitals/render).\n */\n slowFrames: number;\n /**\n * Total amount of freeze durations, in seconds. Freeze is an amount of time every frame rendering was delayed by in comparison with the ideal performant frame.\n * For example if expected frame duration was 16ms, but in reality we've rendered this frame in 320ms, we have a freeze with 304ms duration.\n */\n freezeTime: number;\n /**\n * Total duration of the screen session, in seconds. It is counted by summing up all rendered frames duration.\n */\n sessionDuration: number;\n};\n\nexport interface Metric {\n timestamp: string;\n category: string;\n name: string;\n value: number;\n sessionId: string;\n routeName?: string;\n params?: Record<string, unknown>;\n}\n\nexport type MetricAttributes = {\n /**\n * Name of the route associated with the metric. Some metrics populate this\n * with a sensible default when omitted — for example, the TTI metric falls\n * back to the initial route name detected from the router.\n */\n routeName?: string;\n /**\n * Custom parameters to attach to the metric.\n */\n params?: Record<string, unknown>;\n};\n\n/**\n * Severity of a log event, ordered from least to most severe:\n *\n * - `\"trace\"` — Fine-grained tracing, typically only useful while reproducing\n * a specific issue.\n * - `\"debug\"` — Diagnostic detail useful during development; usually filtered\n * out in production.\n * - `\"info\"` — Routine, expected events that record normal app behavior.\n * - `\"warn\"` — Unexpected but recoverable conditions worth investigating.\n * - `\"error\"` — An operation failed; the app continues running but is in a\n * degraded state.\n * - `\"fatal\"` — A severe failure, often immediately followed by app termination.\n */\nexport type LogSeverity = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';\n\n/**\n * Value types accepted in a log event's `attributes` map. Strings, numbers,\n * and booleans are stored as typed primitives; arrays and nested maps preserve\n * their structure. Other JS values (functions, `Date`, `undefined`, etc.) are\n * not supported and may be dropped by downstream consumers.\n */\nexport type LogAttributeValue =\n | string\n | number\n | boolean\n | LogAttributeValue[]\n | { [key: string]: LogAttributeValue };\n\n/**\n * A single log event collected during a session.\n */\nexport type LogRecord = {\n /**\n * ISO 8601 timestamp of when the record was created.\n */\n timestamp: string;\n /**\n * Event name.\n */\n name: string;\n /**\n * Optional free-form message describing the event.\n */\n body?: string | null;\n /**\n * Custom attributes attached to the event. Each entry is preserved with its\n * original value type — see `LogAttributeValue` for the supported shapes.\n */\n attributes?: Record<string, LogAttributeValue> | null;\n /**\n * Severity of the event.\n */\n severity: LogSeverity;\n};\n\n/**\n * Optional configuration accepted by `logEvent`. The event name is passed as\n * the first positional argument since it's required and the only field most\n * callers set.\n */\nexport type LogEventOptions = {\n /**\n * Optional free-form message describing the event.\n */\n body?: string | null;\n /**\n * Custom attributes attached to the event. Each entry is preserved with its\n * original value type — see `LogAttributeValue` for the supported shapes.\n */\n attributes?: Record<string, LogAttributeValue> | null;\n /**\n * Severity of the event.\n *\n * @default \"info\"\n */\n severity?: LogSeverity | null;\n};\n\nexport type SessionType = 'main' | 'foreground' | 'screen' | 'custom' | 'unknown';\n\nexport type CrashKind =\n | 'badAccess'\n | 'fatalError'\n | 'divideByZero'\n | 'forceUnwrapNil'\n | 'arrayOutOfBounds'\n | 'objcException'\n | 'stackOverflow';\n\ntype SessionBase = {\n id: string;\n startDate: string;\n endDate?: string | null;\n metrics: Metric[];\n logs: LogRecord[];\n};\n\nexport type MainSession = SessionBase & {\n type: 'main';\n crashReport?: CrashReport | null;\n};\n\nexport type GenericSession = SessionBase & {\n type: Exclude<SessionType, 'main'>;\n};\n\nexport type Session = MainSession | GenericSession;\n\nexport type CallStackFrame = {\n binaryName?: string | null;\n binaryUUID?: string | null;\n address?: number | null;\n offsetIntoBinaryTextSegment?: number | null;\n sampleCount?: number | null;\n subFrames?: CallStackFrame[] | null;\n /**\n * Resolved symbol from on-device `dladdr` symbolication. Swift and Itanium-ABI C++\n * names are demangled; Objective-C selectors and plain C symbols are returned as-is.\n * `null` when the binary is not loaded in this process or `dladdr` could not resolve it.\n *\n * @platform ios\n */\n symbol?: string | null;\n};\n\nexport type CallStack = {\n threadAttributed?: boolean | null;\n callStackRootFrames?: CallStackFrame[] | null;\n};\n\nexport type CallStackTree = {\n callStacks?: CallStack[] | null;\n};\n\nexport type CrashReport = {\n exceptionType?: number | null;\n exceptionCode?: number | null;\n signal?: number | null;\n terminationReason?: string | null;\n virtualMemoryRegionInfo?: string | null;\n exceptionReason?: {\n composedMessage: string;\n formatString: string;\n arguments: string[];\n exceptionType: string;\n className: string;\n exceptionName: string;\n } | null;\n callStackTree?: CallStackTree | null;\n timestampBegin: string;\n timestampEnd: string;\n ingestedAt: string;\n};\n\nexport interface ExpoAppMetricsModuleType {\n markFirstRender(): void;\n markInteractive(attributes?: MetricAttributes): void;\n /**\n * Records a log event against the current main session. The event is\n * persisted locally and dispatched on the next `dispatchEvents()` flush as an\n * OpenTelemetry log record sent to the `/v1/logs` endpoint.\n *\n * Severity defaults to `\"info\"` when not provided.\n *\n * @param name Event name. Maps to the OpenTelemetry `event.name` attribute.\n * @param options Optional body, attributes, and severity overrides.\n */\n logEvent(name: string, options?: LogEventOptions): void;\n getStoredEntries(): Promise<Metric[]>;\n clearStoredEntries(): Promise<void>;\n /**\n * Returns all sessions across the current and historical entries,\n * ordered with the current launch first.\n *\n * @private This API is unstable and may change without notice.\n * @platform ios\n */\n getAllSessions(): Promise<Session[]>;\n\n /**\n * Simulates a crash report, attributing it to the current main session.\n * Intended for development and debugging only.\n *\n * @private This API is unstable and may change without notice.\n * @platform ios\n */\n simulateCrashReport(): void;\n\n /**\n * Intentionally crashes the app to produce a real MetricKit diagnostic.\n * Intended for development and debugging only.\n *\n * @private This API is unstable and may change without notice.\n * @platform ios\n */\n triggerCrash(kind: CrashKind): void;\n\n /**\n * Starts a new app metrics session. Returns the session ID.\n *\n * @platform android\n */\n startSession(): string;\n /**\n * Stops the app metrics session with the given session ID.\n *\n * @platform android\n */\n stopSession(sessionId: string): void;\n /**\n * @platform android\n */\n addCustomMetricToSession(\n sessionId: string,\n metric: {\n category: string;\n name: string;\n value: number;\n routeName?: string;\n params?: Record<string, unknown>;\n }\n ): Promise<void>;\n}\n"]}
@@ -9,7 +9,7 @@
9
9
  "publication": {
10
10
  "groupId": "expo.modules.appmetrics",
11
11
  "artifactId": "expo.modules.appmetrics",
12
- "version": "0.2.0",
12
+ "version": "56.0.0",
13
13
  "repository": "local-maven-repo"
14
14
  }
15
15
  }
@@ -1,9 +1,26 @@
1
1
  // Copyright 2025-present 650 Industries. All rights reserved.
2
2
  import ExpoModulesCore
3
3
 
4
+ #if !os(tvOS)
5
+ import MetricKit
6
+ #endif
7
+
4
8
  public struct AppMetrics {
5
9
  #if !os(tvOS)
6
10
  static let metricKitSubscriber = MetricKitSubscriber()
11
+
12
+ /**
13
+ Registers the MetricKit subscriber to receive diagnostic and performance payloads.
14
+ Even though MetricKit doesn't work on the simulator, it prints some logs (probably once a day)
15
+ that are piped to the terminal when using the `expo run:ios` command.
16
+ To avoid them, we explicitly don't register the subscriber on the simulator.
17
+ */
18
+ static func registerMetricKitSubscriber() {
19
+ #if !targetEnvironment(simulator)
20
+ MXMetricManager.shared.add(metricKitSubscriber)
21
+ metricKitSubscriber.processPastPayloads()
22
+ #endif
23
+ }
7
24
  #endif
8
25
 
9
26
  public static let storage = MetricsStorage()