Skip to content

Commit dc0aa8a

Browse files
committed
Added client version
1 parent 66faa2a commit dc0aa8a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

crates/openshell-core/src/telemetry.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,17 @@ fn timestamp() -> String {
7676
Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true)
7777
}
7878

79+
fn client_version() -> &'static str {
80+
crate::VERSION
81+
}
82+
7983
fn build_payload(name: &str, event: Value, event_ts: &str, sent_ts: &str) -> Value {
8084
json!({
8185
"browserType": "undefined",
8286
"clientId": CLIENT_ID,
8387
"clientType": "Native",
8488
"clientVariant": "Release",
85-
"clientVer": std::env::var("OPENSHELL_SOURCE_CLIENT_VERSION")
86-
.unwrap_or_else(|_| "undefined".to_string()),
89+
"clientVer": client_version(),
8790
"cpuArchitecture": std::env::consts::ARCH,
8891
"deviceGdprBehOptIn": "None",
8992
"deviceGdprFuncOptIn": "None",
@@ -451,6 +454,7 @@ mod tests {
451454
);
452455

453456
assert_eq!(payload["clientId"], CLIENT_ID);
457+
assert_eq!(payload["clientVer"], crate::VERSION);
454458
assert_eq!(payload["eventSchemaVer"], EVENT_SCHEMA_VERSION);
455459
assert_eq!(payload["deviceId"], "undefined");
456460
assert_eq!(payload["userId"], "undefined");

0 commit comments

Comments
 (0)