expo-observe 0.1.0 → 0.1.2
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/OpenTelemetry.kt +4 -2
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/ios/Observability.swift +3 -1
- package/ios/OpenTelemetry.swift +5 -4
- package/ios/Tests/OpenTelemetryTests.swift +1 -1
- package/package.json +3 -4
- package/src/index.ts +2 -0
|
@@ -28,7 +28,7 @@ data class OTAttribute(
|
|
|
28
28
|
@Serializable
|
|
29
29
|
data class OTDataPoint(
|
|
30
30
|
val timeUnixNano: Long,
|
|
31
|
-
val
|
|
31
|
+
val asDouble: Double,
|
|
32
32
|
val attributes: List<OTAttribute>
|
|
33
33
|
)
|
|
34
34
|
|
|
@@ -103,7 +103,7 @@ fun EASMetric.toOTMetric(): OTMetric {
|
|
|
103
103
|
dataPoints = listOf(
|
|
104
104
|
OTDataPoint(
|
|
105
105
|
timeUnixNano = timestampToDateNS(timestamp),
|
|
106
|
-
|
|
106
|
+
asDouble = value,
|
|
107
107
|
attributes = listOf(
|
|
108
108
|
OTAttribute.of(
|
|
109
109
|
key = "session.id",
|
|
@@ -126,6 +126,7 @@ fun Event.toOTMetadata(easClientId: String): OTMetadata {
|
|
|
126
126
|
OTAttribute.of("os.version", metadata.deviceOsVersion ?: ""),
|
|
127
127
|
OTAttribute.of("device.model.name", metadata.deviceName ?: ""),
|
|
128
128
|
OTAttribute.of("device.model.identifier", metadata.deviceModel ?: ""),
|
|
129
|
+
OTAttribute.of("browser.language", metadata.languageTag ?: ""),
|
|
129
130
|
OTAttribute.of("telemetry.sdk.name", "expo-observe"),
|
|
130
131
|
OTAttribute.of("telemetry.sdk.version", metadata.clientVersion ?: ""),
|
|
131
132
|
OTAttribute.of("telemetry.sdk.language", "kotlin"),
|
|
@@ -133,6 +134,7 @@ fun Event.toOTMetadata(easClientId: String): OTMetadata {
|
|
|
133
134
|
OTAttribute.of("expo.app.build_number", metadata.appBuildNumber ?: ""),
|
|
134
135
|
OTAttribute.of("expo.app.update_id", metadata.appUpdateId ?: ""),
|
|
135
136
|
OTAttribute.of("expo.sdk.version", metadata.expoSdkVersion),
|
|
137
|
+
OTAttribute.of("expo.environment", metadata.environment ?: ""),
|
|
136
138
|
OTAttribute.of("expo.react_native.version", metadata.reactNativeVersion),
|
|
137
139
|
OTAttribute.of("expo.eas_client.id", easClientId)
|
|
138
140
|
)
|
package/build/index.d.ts
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","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"}
|
package/build/index.js
CHANGED
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,EAAE,MAAM,UAAU,CAAC;AACnC,cAAc,SAAS,CAAC","sourcesContent":["export { default } from './module';\nexport * from './types';\n"]}
|
|
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":["export { default as AppMetrics, AppMetricsRoot } from 'expo-app-metrics';\n\nexport { default } from './module';\nexport * from './types';\n"]}
|
package/ios/Observability.swift
CHANGED
|
@@ -67,7 +67,9 @@ internal struct ObservabilityManager {
|
|
|
67
67
|
request.allHTTPHeaderFields = ["Content-Type": "application/json"]
|
|
68
68
|
request.httpBody = try body.toData([])
|
|
69
69
|
|
|
70
|
-
observeLogger.debug("[EAS Observe] Sending the request to \(endpointUrl) with body:
|
|
70
|
+
observeLogger.debug("[EAS Observe] Sending the request to \(endpointUrl) with body:")
|
|
71
|
+
// Use `print` so the JSON can be copied without including the log level emojis.
|
|
72
|
+
print(try body.toString(.prettyPrinted))
|
|
71
73
|
|
|
72
74
|
let (responseData, urlResponse) = try await URLSession.shared.data(for: request)
|
|
73
75
|
|
package/ios/OpenTelemetry.swift
CHANGED
|
@@ -18,7 +18,7 @@ struct OTAttribute: Codable, Sendable {
|
|
|
18
18
|
|
|
19
19
|
struct OTDataPoint: Codable, Sendable {
|
|
20
20
|
let timeUnixNano: UInt64
|
|
21
|
-
let
|
|
21
|
+
let asDouble: Double
|
|
22
22
|
let attributes: [OTAttribute]
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -85,7 +85,7 @@ extension Event.Metric {
|
|
|
85
85
|
gauge: OTGauge(dataPoints: [
|
|
86
86
|
OTDataPoint(
|
|
87
87
|
timeUnixNano: nsFromISODateString(),
|
|
88
|
-
|
|
88
|
+
asDouble: self.value,
|
|
89
89
|
attributes: [
|
|
90
90
|
OTAttribute(
|
|
91
91
|
key: "session.id",
|
|
@@ -108,6 +108,7 @@ extension Event {
|
|
|
108
108
|
OTAttribute(key: "os.version", rawValue: metadata.deviceOsVersion),
|
|
109
109
|
OTAttribute(key: "device.model.name", rawValue: metadata.deviceName),
|
|
110
110
|
OTAttribute(key: "device.model.identifier", rawValue: metadata.deviceModel),
|
|
111
|
+
OTAttribute(key: "browser.language", rawValue: metadata.languageTag),
|
|
111
112
|
OTAttribute(key: "telemetry.sdk.name", rawValue: "expo-observe"),
|
|
112
113
|
OTAttribute(key: "telemetry.sdk.version", rawValue: ObserveVersions.clientVersion),
|
|
113
114
|
OTAttribute(key: "telemetry.sdk.language", rawValue: "swift"),
|
|
@@ -115,9 +116,9 @@ extension Event {
|
|
|
115
116
|
OTAttribute(key: "expo.app.build_number", rawValue: metadata.appBuildNumber ?? ""),
|
|
116
117
|
OTAttribute(key: "expo.app.update_id", rawValue: metadata.appUpdateId ?? ""),
|
|
117
118
|
OTAttribute(key: "expo.sdk.version", rawValue: metadata.expoSdkVersion),
|
|
119
|
+
OTAttribute(key: "expo.environment", rawValue: metadata.environment ?? ""),
|
|
118
120
|
OTAttribute(key: "expo.react_native.version", rawValue: metadata.reactNativeVersion),
|
|
119
|
-
OTAttribute(key: "expo.eas_client.id", rawValue: easClientId)
|
|
120
|
-
|
|
121
|
+
OTAttribute(key: "expo.eas_client.id", rawValue: easClientId),
|
|
121
122
|
])
|
|
122
123
|
}
|
|
123
124
|
|
|
@@ -96,7 +96,7 @@ struct OpenTelemetryTests {
|
|
|
96
96
|
#expect(otMetric.gauge.dataPoints.count == 1)
|
|
97
97
|
|
|
98
98
|
let dataPoint = otMetric.gauge.dataPoints[0]
|
|
99
|
-
#expect(dataPoint.
|
|
99
|
+
#expect(dataPoint.asDouble == 3.14)
|
|
100
100
|
#expect(dataPoint.attributes.count == 1)
|
|
101
101
|
#expect(dataPoint.attributes[0].key == "session.id")
|
|
102
102
|
#expect(dataPoint.attributes[0].value.stringValue == testSessionId)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-observe",
|
|
3
3
|
"title": "Expo Observe",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"description": "Expo module that dispatches collected app metrics to EAS Observe",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"types": "build/index.d.ts",
|
|
@@ -33,9 +33,8 @@
|
|
|
33
33
|
"author": "650 Industries, Inc.",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"expo-app-metrics": "
|
|
37
|
-
"expo-eas-client": "
|
|
38
|
-
"expo-updates-interface": "^55.0.0"
|
|
36
|
+
"expo-app-metrics": "~0.1.2",
|
|
37
|
+
"expo-eas-client": "~55.0.3"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
41
40
|
"expo-module-scripts": "^5.0.7"
|
package/src/index.ts
CHANGED