Skip to content

Commit 4590f5e

Browse files
committed
Fix metrics send
1 parent 945b104 commit 4590f5e

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

src/bin/agent/core/service.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ pub async fn run(settings: AgentSettings) -> Result<()> {
321321
tokio::select! {
322322
_ = sleep(Duration::from_secs(settings.agent.metrics_interval)) => {
323323
match agent.send_metrics(&carbon_addr).await {
324-
Ok(_) => log::debug!("✅ Sent metrics to {}", carbon_addr),
324+
Ok(_) => {},
325325
Err(e) => log::error!("❌ Failed to send metrics: {}", e),
326326
}
327327
},
@@ -345,7 +345,7 @@ pub async fn run(settings: AgentSettings) -> Result<()> {
345345
tokio::select! {
346346
_ = sleep(Duration::from_secs(settings.agent.metrics_hb_interval)) => {
347347
match agent.send_hb_metric(&carbon_addr).await {
348-
Ok(_) => log::debug!("✅ Sent heartbeat to {}", carbon_addr),
348+
Ok(_) => {},
349349
Err(e) => log::error!("❌ Failed to send heartbeat: {}", e),
350350
}
351351
},

src/metrics/metrics.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,13 @@ impl<T: Default> Default for Metric<T> {
4444

4545
impl<T: fmt::Display> fmt::Display for Metric<T> {
4646
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
47-
write!(
48-
f,
49-
"Metric {{ path: {}, value: {}, timestamp: {} }}",
50-
self.metric, self.value, self.timestamp
51-
)
47+
write!(f, "{} {} {}", self.metric, self.value, self.timestamp)
5248
}
5349
}
5450

5551
impl<T: std::fmt::Display + std::fmt::Debug> Metric<T> {
5652
pub async fn send(&self, server: &str) -> Result<(), io::Error> {
57-
let metric_string = self.to_string();
53+
let metric_string = format!("{}\n", self.to_string());
5854

5955
log::debug!("Sending carbon metric string: {}", metric_string);
6056

0 commit comments

Comments
 (0)