Skip to content

Commit

Permalink
chore: show version report data only once at db startup (#2647)
Browse files Browse the repository at this point in the history
  • Loading branch information
paomian authored Oct 25, 2023
1 parent 16a3257 commit 102e4c9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/common/greptimedb-telemetry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ pub struct GreptimeDBTelemetry {
working_home: Option<String>,
telemetry_url: &'static str,
should_report: Arc<AtomicBool>,
report_times: usize,
}

#[async_trait::async_trait]
Expand Down Expand Up @@ -242,6 +243,7 @@ impl GreptimeDBTelemetry {
client: client.ok(),
telemetry_url: TELEMETRY_URL,
should_report,
report_times: 0,
}
}

Expand All @@ -259,8 +261,11 @@ impl GreptimeDBTelemetry {
};

if let Some(client) = self.client.as_ref() {
info!("reporting greptimedb version: {:?}", data);
if self.report_times == 0 {
info!("reporting greptimedb version: {:?}", data);
}
let result = client.post(self.telemetry_url).json(&data).send().await;
self.report_times += 1;
debug!("report version result: {:?}", result);
result.ok()
} else {
Expand Down

0 comments on commit 102e4c9

Please sign in to comment.