expo-observe 0.1.3 → 0.1.4
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.
|
@@ -122,29 +122,56 @@ fun EASMetric.toOTMetric(): OTMetric {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
fun Event.toOTMetadata(easClientId: String): OTMetadata {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
OTAttribute.of("device.model.identifier", metadata.deviceModel ?: ""),
|
|
134
|
-
OTAttribute.of("browser.language", metadata.languageTag ?: ""),
|
|
135
|
-
OTAttribute.of("telemetry.sdk.name", "expo-observe"),
|
|
136
|
-
OTAttribute.of("telemetry.sdk.version", metadata.clientVersion ?: ""),
|
|
137
|
-
OTAttribute.of("telemetry.sdk.language", "kotlin"),
|
|
138
|
-
OTAttribute.of("expo.app.name", metadata.appName ?: ""),
|
|
139
|
-
OTAttribute.of("expo.app.build_number", metadata.appBuildNumber ?: ""),
|
|
140
|
-
OTAttribute.of("expo.app.update_id", metadata.appUpdateId ?: ""),
|
|
141
|
-
OTAttribute.of("expo.sdk.version", metadata.expoSdkVersion),
|
|
142
|
-
OTAttribute.of("expo.environment", metadata.environment ?: ""),
|
|
143
|
-
OTAttribute.of("expo.react_native.version", metadata.reactNativeVersion),
|
|
144
|
-
OTAttribute.of("expo.eas_client.id", easClientId),
|
|
145
|
-
OTAttribute.of("expo.eas_build.id", metadata.appEasBuildId ?: "")
|
|
146
|
-
)
|
|
125
|
+
val attributes = mutableListOf(
|
|
126
|
+
OTAttribute.of("service.name", metadata.appIdentifier),
|
|
127
|
+
OTAttribute.of("os.type", "linux"),
|
|
128
|
+
OTAttribute.of("telemetry.sdk.name", "expo-observe"),
|
|
129
|
+
OTAttribute.of("telemetry.sdk.language", "kotlin"),
|
|
130
|
+
OTAttribute.of("expo.sdk.version", metadata.expoSdkVersion),
|
|
131
|
+
OTAttribute.of("expo.react_native.version", metadata.reactNativeVersion),
|
|
132
|
+
OTAttribute.of("expo.eas_client.id", easClientId),
|
|
147
133
|
)
|
|
134
|
+
|
|
135
|
+
// Send optional attributes only if they are set.
|
|
136
|
+
// Their defaults should be defined by the backend.
|
|
137
|
+
metadata.appVersion?.let {
|
|
138
|
+
attributes.add(OTAttribute.of("service.version", it))
|
|
139
|
+
}
|
|
140
|
+
metadata.deviceOs?.let {
|
|
141
|
+
attributes.add(OTAttribute.of("os.name", it))
|
|
142
|
+
}
|
|
143
|
+
metadata.deviceOsVersion?.let {
|
|
144
|
+
attributes.add(OTAttribute.of("os.version", it))
|
|
145
|
+
}
|
|
146
|
+
metadata.deviceName?.let {
|
|
147
|
+
attributes.add(OTAttribute.of("device.model.name", it))
|
|
148
|
+
}
|
|
149
|
+
metadata.deviceModel?.let {
|
|
150
|
+
attributes.add(OTAttribute.of("device.model.identifier", it))
|
|
151
|
+
}
|
|
152
|
+
metadata.languageTag?.let {
|
|
153
|
+
attributes.add(OTAttribute.of("browser.language", it))
|
|
154
|
+
}
|
|
155
|
+
metadata.clientVersion?.let {
|
|
156
|
+
attributes.add(OTAttribute.of("telemetry.sdk.version", it))
|
|
157
|
+
}
|
|
158
|
+
metadata.appName?.let {
|
|
159
|
+
attributes.add(OTAttribute.of("expo.app.name", it))
|
|
160
|
+
}
|
|
161
|
+
metadata.appBuildNumber?.let {
|
|
162
|
+
attributes.add(OTAttribute.of("expo.app.build_number", it))
|
|
163
|
+
}
|
|
164
|
+
metadata.appUpdateId?.let {
|
|
165
|
+
attributes.add(OTAttribute.of("expo.app.update_id", it))
|
|
166
|
+
}
|
|
167
|
+
metadata.environment?.let {
|
|
168
|
+
attributes.add(OTAttribute.of("expo.environment", it))
|
|
169
|
+
}
|
|
170
|
+
metadata.appEasBuildId?.let {
|
|
171
|
+
attributes.add(OTAttribute.of("expo.eas_build.id", it))
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return OTMetadata(attributes = attributes)
|
|
148
175
|
}
|
|
149
176
|
|
|
150
177
|
fun Event.toOTEvent(easClientId: String): OTEvent {
|
package/ios/OpenTelemetry.swift
CHANGED
|
@@ -105,9 +105,7 @@ extension Event.Metric {
|
|
|
105
105
|
|
|
106
106
|
extension Event {
|
|
107
107
|
func toOTMetadata(_ easClientId: String) -> OTMetadata {
|
|
108
|
-
|
|
109
|
-
OTAttribute(key: "service.name", rawValue: Bundle.main.bundleIdentifier ?? ""),
|
|
110
|
-
OTAttribute(key: "service.version", rawValue: metadata.appVersion ?? ""),
|
|
108
|
+
var attributes: [OTAttribute] = [
|
|
111
109
|
OTAttribute(key: "os.type", rawValue: "darwin"),
|
|
112
110
|
OTAttribute(key: "os.name", rawValue: metadata.deviceOs),
|
|
113
111
|
OTAttribute(key: "os.version", rawValue: metadata.deviceOsVersion),
|
|
@@ -117,15 +115,35 @@ extension Event {
|
|
|
117
115
|
OTAttribute(key: "telemetry.sdk.name", rawValue: "expo-observe"),
|
|
118
116
|
OTAttribute(key: "telemetry.sdk.version", rawValue: ObserveVersions.clientVersion),
|
|
119
117
|
OTAttribute(key: "telemetry.sdk.language", rawValue: "swift"),
|
|
120
|
-
OTAttribute(key: "expo.app.name", rawValue: metadata.appName ?? ""),
|
|
121
|
-
OTAttribute(key: "expo.app.build_number", rawValue: metadata.appBuildNumber ?? ""),
|
|
122
|
-
OTAttribute(key: "expo.app.update_id", rawValue: metadata.appUpdateId ?? ""),
|
|
123
118
|
OTAttribute(key: "expo.sdk.version", rawValue: metadata.expoSdkVersion),
|
|
124
|
-
OTAttribute(key: "expo.environment", rawValue: metadata.environment ?? ""),
|
|
125
119
|
OTAttribute(key: "expo.react_native.version", rawValue: metadata.reactNativeVersion),
|
|
126
120
|
OTAttribute(key: "expo.eas_client.id", rawValue: easClientId),
|
|
127
|
-
|
|
128
|
-
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
// Send optional attributes only if they are set.
|
|
124
|
+
// Their defaults should be defined by the backend.
|
|
125
|
+
if let appIdentifier = metadata.appIdentifier {
|
|
126
|
+
attributes.append(OTAttribute(key: "service.name", rawValue: appIdentifier))
|
|
127
|
+
}
|
|
128
|
+
if let appVersion = metadata.appVersion {
|
|
129
|
+
attributes.append(OTAttribute(key: "service.version", rawValue: appVersion))
|
|
130
|
+
}
|
|
131
|
+
if let appName = metadata.appName {
|
|
132
|
+
attributes.append(OTAttribute(key: "expo.app.name", rawValue: appName))
|
|
133
|
+
}
|
|
134
|
+
if let appBuildNumber = metadata.appBuildNumber {
|
|
135
|
+
attributes.append(OTAttribute(key: "expo.app.build_number", rawValue: appBuildNumber))
|
|
136
|
+
}
|
|
137
|
+
if let appUpdateId = metadata.appUpdateId {
|
|
138
|
+
attributes.append(OTAttribute(key: "expo.app.update_id", rawValue: appUpdateId))
|
|
139
|
+
}
|
|
140
|
+
if let environment = metadata.environment {
|
|
141
|
+
attributes.append(OTAttribute(key: "expo.environment", rawValue: environment))
|
|
142
|
+
}
|
|
143
|
+
if let appEasBuildId = metadata.appEasBuildId {
|
|
144
|
+
attributes.append(OTAttribute(key: "expo.eas_build.id", rawValue: appEasBuildId))
|
|
145
|
+
}
|
|
146
|
+
return OTMetadata(attributes: attributes)
|
|
129
147
|
}
|
|
130
148
|
|
|
131
149
|
func toOTEvent(_ easClientId: String) -> OTEvent {
|
|
@@ -136,7 +136,7 @@ struct OpenTelemetryTests {
|
|
|
136
136
|
#expect(attrs["expo.sdk.version"] == "55.0.0")
|
|
137
137
|
#expect(attrs["expo.react_native.version"] == "0.83.1")
|
|
138
138
|
#expect(attrs["expo.eas_client.id"] == testEasClientId)
|
|
139
|
-
#expect(attrs["expo.eas_build.id"] ==
|
|
139
|
+
#expect(attrs["expo.eas_build.id"] == nil)
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
// MARK: - Full OTEvent
|
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.4",
|
|
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,7 +33,7 @@
|
|
|
33
33
|
"author": "650 Industries, Inc.",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"expo-app-metrics": "~0.1.
|
|
36
|
+
"expo-app-metrics": "~0.1.4",
|
|
37
37
|
"expo-eas-client": "~55.0.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|