Skip to content

Commit ca867f6

Browse files
authored
Add support for chrome trace exporter (#4712)
## Motivation Right now for tracing information we can only visualize it using Tempo, which doesn't really work for local client runs. ## Proposal Add support for `ChromeTraceExporter`, which generates a JSON file that can be ingested by the Perfetto UI for visualization. ## Test Plan Ran the client locally with the `OTEL_EXPORTER_TYPE=chrome_json`, got the JSON file and managed to see the tracing data in the Perfetto UI https://ui.perfetto.dev/#!/viewer?local_cache_key=00000000-0000-0000-f5e0-334428275111 ## Release Plan - Nothing to do / These changes follow the usual release cycle.
1 parent 5508bca commit ca867f6

File tree

14 files changed

+441
-183
lines changed

14 files changed

+441
-183
lines changed

CLI.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ Client implementation and command-line tool for the Linera blockchain
146146
* `--max-retries <MAX_RETRIES>` — Number of times to retry connecting to a validator
147147

148148
Default value: `10`
149+
* `--chrome-trace-exporter` — Enable OpenTelemetry Chrome JSON exporter for trace data analysis
150+
* `--otel-trace-file <OTEL_TRACE_FILE>` — Output file path for Chrome trace JSON format. Can be visualized in chrome://tracing or Perfetto UI
151+
* `--otel-exporter-otlp-endpoint <OTEL_EXPORTER_OTLP_ENDPOINT>` — OpenTelemetry OTLP exporter endpoint (requires tempo feature)
149152
* `--wait-for-outgoing-messages` — Whether to wait until a quorum of validators has confirmed that all sent cross-chain messages have been delivered
150153
* `--long-lived-services` — (EXPERIMENTAL) Whether application services can persist in some cases between queries
151154
* `--blanket-message-policy <BLANKET_MESSAGE_POLICY>` — The policy for handling incoming messages

Cargo.lock

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ tonic-web-wasm-client = "0.8.0"
260260
tower = "0.4.13"
261261
tower-http = "0.6.6"
262262
tracing = { version = "0.1.40", features = ["release_max_level_debug"] }
263+
tracing-chrome = "0.7.2"
263264
tracing-opentelemetry = "0.31.0"
264265
tracing-subscriber = { version = "0.3.18", default-features = false, features = [
265266
"env-filter",

examples/Cargo.lock

Lines changed: 88 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

linera-base/Cargo.toml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ workspace = true
1818
metrics = ["prometheus"]
1919
reqwest = ["dep:reqwest"]
2020
revm = []
21-
tempo = [
22-
"opentelemetry",
23-
"opentelemetry-otlp",
24-
"opentelemetry_sdk",
25-
"tracing-opentelemetry",
26-
]
21+
tempo = ["opentelemetry-otlp"]
2722
test = ["test-strategy", "proptest"]
2823
web = [
2924
"getrandom/js",
@@ -86,10 +81,11 @@ tracing-web = { optional = true, workspace = true }
8681

8782
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
8883
chrono.workspace = true
89-
opentelemetry = { workspace = true, optional = true }
84+
opentelemetry.workspace = true
9085
opentelemetry-otlp = { workspace = true, optional = true }
91-
opentelemetry_sdk = { workspace = true, optional = true }
92-
tracing-opentelemetry = { workspace = true, optional = true }
86+
opentelemetry_sdk.workspace = true
87+
tracing-chrome.workspace = true
88+
tracing-opentelemetry.workspace = true
9389
rand = { workspace = true, features = ["getrandom", "std", "std_rng"] }
9490
tokio = { workspace = true, features = [
9591
"process",
@@ -107,6 +103,7 @@ assert_matches.workspace = true
107103
bcs.workspace = true
108104
linera-base = { path = ".", default-features = false, features = ["test"] }
109105
linera-witty = { workspace = true, features = ["test"] }
106+
tempfile.workspace = true
110107
test-case.workspace = true
111108

112109
[build-dependencies]

linera-base/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ pub use task::Blocking;
4040
pub mod time;
4141
#[cfg_attr(web, path = "tracing_web.rs")]
4242
pub mod tracing;
43+
#[cfg(not(target_arch = "wasm32"))]
44+
pub mod tracing_otel;
4345
#[cfg(test)]
4446
mod unit_tests;
4547

0 commit comments

Comments
 (0)