Skip to content

Commit

Permalink
feat: add tracing for proxy and worker
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiagoPittella committed Dec 13, 2024
1 parent 7dfc1c3 commit e09374f
Show file tree
Hide file tree
Showing 11 changed files with 479 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Changes

- Added tracing to the `miden-tx-prover` CLI (#1014).
- Added health check endpoints to the prover service (#1006).
- Implemented serialization for `AccountHeader` (#996).
- Updated Pingora crates to 0.4 and added polling time to the configuration file (#997).
Expand Down
223 changes: 223 additions & 0 deletions Cargo.lock

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

7 changes: 7 additions & 0 deletions bin/tx-prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@ tonic = { version = "0.12", default-features = false, features = ["prost", "code
getrandom = { version = "0.2", features = ["js"], optional = true }

[target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dependencies]
bytes = "1.0"
tonic = { version = "0.12", default-features = false, features = ["prost", "codegen", "transport"] }
once_cell = "1.19.0"
pingora = { version = "0.4", features = [ "lb" ] }
pingora-core = "0.4"
pingora-proxy = "0.4"
pingora-limits = "0.4"
opentelemetry = { version = "0.27", features = ["metrics", "trace"] }
opentelemetry-otlp = { version = "0.27", features = ["grpc-tonic"] }
opentelemetry_sdk = { version = "0.27", features = ["metrics", "rt-tokio"] }
opentelemetry-semantic-conventions = "0.27.0"
opentelemetry-jaeger = "0.22.0"
tracing-opentelemetry = "0.28"

[dependencies]
async-trait = "0.1"
Expand Down
10 changes: 10 additions & 0 deletions bin/tx-prover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ The proxy service uses this health check to determine if a worker is available t

Both the worker and the proxy will use the `info` log level by default, but it can be changed by setting the `RUST_LOG` environment variable.

## Traces

The service uses the `tracing` crate for structured logging and tracing. Traces are enabled by default, and uses opentelemetry to export traces to a Jaeger instance. The traces can be visualized using the Jaeger UI, which can be used by running:

```bash
docker run -d -p4317:4317 -p16686:16686 jaegertracing/all-in-one:latest
```

Then, you can access the Jaeger UI by opening `http://localhost:16686/` in your browser.

## Features

Description of this crate's feature:
Expand Down
12 changes: 11 additions & 1 deletion bin/tx-prover/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ use miden_tx_prover::generated::{
};
use tokio::{net::TcpListener, sync::Mutex};
use tonic::{Request, Response, Status};
use tracing::info;
use tracing::{debug, info, instrument};

use crate::utils::TRACING_TARGET_NAME;

pub struct RpcListener {
pub api_service: ApiServer<ProverRpcApi>,
Expand All @@ -30,10 +32,18 @@ pub struct ProverRpcApi {

#[async_trait::async_trait]
impl ProverApi for ProverRpcApi {
#[instrument(
target = TRACING_TARGET_NAME,
name = "prover:prove_transaction",
skip_all,
ret(level = "info"),
err
)]
async fn prove_transaction(
&self,
request: Request<ProveTransactionRequest>,
) -> Result<Response<ProveTransactionResponse>, tonic::Status> {
debug!(request = ?request, "Processing reply");
info!("Received request to prove transaction");

// Try to acquire a permit without waiting
Expand Down
Loading

0 comments on commit e09374f

Please sign in to comment.