Skip to content

send analytics flag to analytics server #1354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 21, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/utils/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ use std::time::Duration;

use anyhow::anyhow;
use chrono::{DateTime, Utc};
use http::header;

use crate::about;
use crate::{about, parseable::PARSEABLE};

use super::uid;

Expand All @@ -32,11 +33,19 @@ pub struct LatestRelease {
}

pub async fn get_latest(deployment_id: &uid::Uid) -> Result<LatestRelease, anyhow::Error> {
let send_analytics = PARSEABLE.options.send_analytics.to_string();
let mut headers = header::HeaderMap::new();
headers.insert(
"P_SEND_ANONYMOUS_USAGE_DATA",
header::HeaderValue::from_str(send_analytics.as_str()).expect("valid header value"),
);
let agent = reqwest::ClientBuilder::new()
.user_agent(about::user_agent(deployment_id))
.default_headers(headers)
.timeout(Duration::from_secs(8))
.build()
.expect("client can be built on this system");

let json: serde_json::Value = agent
.get("https://download.parseable.io/latest-version")
.send()
Expand Down
Loading