Skip to content

Commit c3c402d

Browse files
chore: send analytics flag to analytics server (#1354)
1 parent 4240fb5 commit c3c402d

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/about.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,15 @@ pub fn get_latest_release() -> &'static Option<LatestRelease> {
7171
}
7272

7373
// User Agent for Download API call
74-
// Format: Parseable/<UID>/<version>/<commit_hash> (<OS>; <Platform>)
75-
pub fn user_agent(uid: &Ulid) -> String {
74+
// Format: Parseable/<UID>/<version>/<commit_hash>/<send_analytics> (<OS>; <Platform>)
75+
pub fn user_agent(uid: &Ulid, send_analytics: bool) -> String {
7676
analytics::refresh_sys_info();
7777
format!(
78-
"Parseable/{}/{}/{} ({:?}; {})",
78+
"Parseable/{}/{}/{}/{} ({:?}; {})",
7979
uid,
8080
current().released_version,
8181
current().commit_hash,
82+
send_analytics,
8283
System::name().unwrap_or_default(),
8384
platform()
8485
)

src/utils/update.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::time::Duration;
2121
use anyhow::anyhow;
2222
use chrono::{DateTime, Utc};
2323

24-
use crate::about;
24+
use crate::{about, parseable::PARSEABLE};
2525

2626
use super::uid;
2727

@@ -32,11 +32,13 @@ pub struct LatestRelease {
3232
}
3333

3434
pub async fn get_latest(deployment_id: &uid::Uid) -> Result<LatestRelease, anyhow::Error> {
35+
let send_analytics = PARSEABLE.options.send_analytics;
3536
let agent = reqwest::ClientBuilder::new()
36-
.user_agent(about::user_agent(deployment_id))
37+
.user_agent(about::user_agent(deployment_id, send_analytics))
3738
.timeout(Duration::from_secs(8))
3839
.build()
3940
.expect("client can be built on this system");
41+
4042
let json: serde_json::Value = agent
4143
.get("https://download.parseable.io/latest-version")
4244
.send()

0 commit comments

Comments
 (0)