Skip to content

Commit

Permalink
Merge pull request #39 from zama-ai/davidk/tracing
Browse files Browse the repository at this point in the history
feat: add opentelemetry tracing support
  • Loading branch information
david-zk authored Sep 30, 2024
2 parents 3670bd2 + fdb469c commit 2a695ec
Show file tree
Hide file tree
Showing 8 changed files with 321 additions and 53 deletions.
197 changes: 190 additions & 7 deletions fhevm-engine/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions fhevm-engine/coprocessor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ prometheus.workspace = true
log.workspace = true
structured-logger = "1.0.3"
actix-web = "4.9.0"
opentelemetry = "0.25"
opentelemetry-otlp = "0.25"
opentelemetry_sdk = { version = "0.25", features = ["rt-tokio"] }
tonic-tracing-opentelemetry = "0.21"

[dev-dependencies]
testcontainers = "0.21"
Expand Down
5 changes: 5 additions & 0 deletions fhevm-engine/coprocessor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ mod tfhe_worker;
mod types;
mod utils;
mod metrics;
mod tracing;

fn main() {
let args = crate::cli::parse_args();
Expand Down Expand Up @@ -64,6 +65,10 @@ async fn async_main(
.with_default_writer(structured_logger::async_json::new_writer(tokio::io::stdout()))
.init();

if let Err(err) = tracing::setup_tracing() {
panic!("Error while initializing tracing: {:?}", err);
}

let mut set = JoinSet::new();
if args.run_server {
log::info!(target: "async_main", "Initializing api server");
Expand Down
1 change: 1 addition & 0 deletions fhevm-engine/coprocessor/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ pub async fn run_server_iteration(
};

Server::builder()
.layer(tonic_tracing_opentelemetry::middleware::server::OtelGrpcLayer::default())
.add_service(
crate::server::coprocessor::fhevm_coprocessor_server::FhevmCoprocessorServer::new(
service,
Expand Down
Loading

0 comments on commit 2a695ec

Please sign in to comment.