chore: show version report data only once at db startup (#2647)

This commit is contained in:
localhost
2023-10-25 11:38:33 +08:00
committed by GitHub
parent 16a3257ada
commit 102e4c975d

View File

@@ -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]
@@ -242,6 +243,7 @@ impl GreptimeDBTelemetry {
client: client.ok(),
telemetry_url: TELEMETRY_URL,
should_report,
report_times: 0,
}
}
@@ -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 {