From 1eef9912dabaef4d669fe54a008b845da3f4d5f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Tr=C4=85d?= Date: Fri, 1 Mar 2024 15:13:26 +0100 Subject: [PATCH 1/2] Fetch from DB before spawning tasks (#74) --- bin/mpc_node.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/mpc_node.rs b/bin/mpc_node.rs index 692287a..afdf707 100644 --- a/bin/mpc_node.rs +++ b/bin/mpc_node.rs @@ -59,9 +59,9 @@ async fn main() -> eyre::Result<()> { let mut tasks: Vec>> = vec![]; if let Some(coordinator) = config.coordinator { - tasks.push(tokio::spawn(async move { - let coordinator = Arc::new(Coordinator::new(coordinator).await?); + let coordinator = Arc::new(Coordinator::new(coordinator).await?); + tasks.push(tokio::spawn(async move { coordinator.spawn().await?; Ok(()) @@ -69,9 +69,9 @@ async fn main() -> eyre::Result<()> { } if let Some(participant) = config.participant { - tasks.push(tokio::spawn(async move { - let participant = Arc::new(Participant::new(participant).await?); + let participant = Arc::new(Participant::new(participant).await?); + tasks.push(tokio::spawn(async move { participant.spawn().await?; Ok(()) From 909a83cf479f9d85d8b1f30d8df1ed9ddceaf899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Tr=C4=85d?= Date: Fri, 1 Mar 2024 15:13:39 +0100 Subject: [PATCH 2/2] Dzejkop/fix-telemetry-issues (#75) * Fix telemetry connection issues * Update deps --- Cargo.lock | 4 +++- Cargo.toml | 3 ++- src/participant.rs | 4 ++-- src/utils/aws.rs | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9c9f4ef..0c93778 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2198,6 +2198,7 @@ dependencies = [ "itertools 0.12.0", "metrics 0.21.1", "mongodb", + "opentelemetry", "ordered-float", "proptest", "rand", @@ -3774,7 +3775,7 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "telemetry-batteries" version = "0.1.0" -source = "git+https://github.com/worldcoin/telemetry-batteries.git?rev=c7d89a66bfb33423637d147e59de4758d3456c89#c7d89a66bfb33423637d147e59de4758d3456c89" +source = "git+https://github.com/worldcoin/telemetry-batteries.git?rev=e0891328b29d9f85df037633feccca2f74a291a6#e0891328b29d9f85df037633feccca2f74a291a6" dependencies = [ "chrono", "dirs", @@ -3786,6 +3787,7 @@ dependencies = [ "opentelemetry-datadog", "opentelemetry-http", "opentelemetry_sdk", + "reqwest", "serde", "serde_json", "thiserror", diff --git a/Cargo.toml b/Cargo.toml index 87b414f..87f0630 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,12 +37,13 @@ sqlx = { version = "0.7.3", features = [ "postgres", "chrono", ] } -telemetry-batteries = { git = "https://github.com/worldcoin/telemetry-batteries.git", rev = "c7d89a66bfb33423637d147e59de4758d3456c89" } +telemetry-batteries = { git = "https://github.com/worldcoin/telemetry-batteries.git", rev = "e0891328b29d9f85df037633feccca2f74a291a6" } tinytemplate = "1.2.1" tokio = { version = "1.35.1", features = ["macros"] } toml = "0.8.9" tracing = "0.1.40" tracing-subscriber = "0.3.18" +opentelemetry = "0.21.0" url = "2.5.0" [dev-dependencies] diff --git a/src/participant.rs b/src/participant.rs index ad36fa6..da104d3 100644 --- a/src/participant.rs +++ b/src/participant.rs @@ -6,10 +6,10 @@ use distance::Template; use eyre::ContextCompat; use futures::stream::FuturesUnordered; use futures::StreamExt; -use serde::{Deserialize, Serialize}; -use telemetry_batteries::opentelemetry::trace::{ +use opentelemetry::trace::{ SpanContext, SpanId, TraceFlags, TraceId, TraceState, }; +use serde::{Deserialize, Serialize}; use tokio::io::{AsyncReadExt, AsyncWriteExt, BufWriter}; use tokio::net::TcpStream; use tokio::sync::{mpsc, Mutex}; diff --git a/src/utils/aws.rs b/src/utils/aws.rs index 75d9870..ca54070 100644 --- a/src/utils/aws.rs +++ b/src/utils/aws.rs @@ -4,10 +4,10 @@ use std::fmt::Debug; use aws_config::Region; use aws_sdk_sqs::types::{Message, MessageAttributeValue}; use eyre::Context; -use serde::Serialize; -use telemetry_batteries::opentelemetry::trace::{ +use opentelemetry::trace::{ SpanContext, SpanId, TraceFlags, TraceId, TraceState, }; +use serde::Serialize; use crate::config::AwsConfig;