Skip to content

feat(cli): enable traces export via tracing-otlp cli arg#18242

Merged
Rjected merged 53 commits intoparadigmxyz:mainfrom
lean-apple:metrics-builder
Oct 13, 2025
Merged

feat(cli): enable traces export via tracing-otlp cli arg#18242
Rjected merged 53 commits intoparadigmxyz:mainfrom
lean-apple:metrics-builder

Conversation

@lean-apple
Copy link
Contributor

@lean-apple lean-apple commented Sep 3, 2025

Closes #18241.

Add new CLI flag tracing-otlp to export opentelemetry spans either to stdout or to an OTLP HTTP endpoint.

  • Stdout export: --tracing-otlp
  • OTLP endpoint export: --tracing-otlp=http://localhost:4318/v1/traces

Here how I tested :

Example of very simple otel-collector configuration's file, limited for traces export :

receivers:
  otlp:
    protocols:
      http:
        endpoint: 0.0.0.0:4318

exporters:
  debug:
    verbosity: detailed

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [debug]

and then I put up the collector using this config :

docker run -p 4318:4318 \
  -v $(pwd)/test-otlp.yaml:/etc/otel-collector-config.yaml \
  otel/opentelemetry-collector:latest \
  --config=/etc/otel-collector-config.yaml

The build for the node should be done with otlp feature for example cargo build --release -p op-reth --features reth-optimism-cli/otlp.

and then ./target/release/op-reth --tracing-otlp=http://localhost:4318/v1/traces node --dev

or

cargo run --release -p op-reth --features reth-optimism-cli/otlp -- --tracing-otlp=http://localhost:4318/v1/traces node --dev

Depending on the type provided to --tracing-otlp, either it will just print the spans, either you can see them being redirected to the otlp-collector.
cc @Rjected

@lean-apple lean-apple changed the title feat: enable otlp-metrics export via metric.otlp cli arg feat(cli): enable otlp-metrics export via metric.otlp cli arg Sep 3, 2025
@mattsse mattsse added C-enhancement New feature or request A-rpc Related to the RPC implementation labels Sep 11, 2025
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be super useful

we maybe also want to add this to rpc as well?

i dont know much about otlp, maybe @onbjerg could also take a look here?

@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Sep 11, 2025
@shekhirin
Copy link
Member

@lean-apple is this ready for review and can be moved out of a draft?

@lean-apple
Copy link
Contributor Author

Thanks for your review @Rjected :), Addressed most of the comments, open to remove the stdout option if you think it would be useless to keep it.

Let me know if you could try and have some other configuration idea/fix in mind!

@lean-apple lean-apple requested a review from Rjected October 8, 2025 18:53
Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! LGTM

@shekhirin shekhirin dismissed mattsse’s stale review October 13, 2025 10:42

Dan reviewed the PR.

@shekhirin shekhirin added this pull request to the merge queue Oct 13, 2025
@shekhirin shekhirin removed this pull request from the merge queue due to a manual request Oct 13, 2025
@Zygimantass
Copy link
Contributor

Zygimantass commented Oct 13, 2025

Not sure if this should be a part of another PR or this one, but in this current state, the traces / spans aren't super useful as an operator.

CleanShot 2025-10-13 at 12 46 53@2x

Running in dev mode and using Jaeger, I can see that all traces contain only one span, meaning every event happening on the node is "disparate" and unconnected to other events. How I imagine it should (?) be is that every block (or another unit of work) has a trace that is propagated through all events down stream: block building, state root calculation, executing the block, etc.

Another piece of feedback is that none of the spans / traces have any context attached to them, meaning that I can't see whether execute_block was for block 0 or 100.

EDIT:

there's a actually a hacky way to get the block number, but you have to do it through the attached logs, instead of the actual span tags

@Zygimantass
Copy link
Contributor

I'm also only getting 6 types of events (looking at the Reth codebase, there should definitely be more than that?)

CleanShot 2025-10-13 at 12 54 23@2x

#[cfg(feature = "otlp")]
if let Some(output_type) = &self.cli.traces.otlp {
info!(target: "reth::cli", "Starting OTLP tracing export to {:?}", output_type);
layers.with_span_layer("reth::cli".to_string(), output_type.clone())?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might cause the exporter to only export reth::cli related spans, instead of exporting everything globally

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just changed this to reth, not super confident on this but I think this just determines the service name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's the service-name, maybe we can this also as configurable, with reth by default

@Rjected Rjected added this pull request to the merge queue Oct 13, 2025
Merged via the queue into paradigmxyz:main with commit 59ace58 Oct 13, 2025
39 of 40 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Oct 13, 2025
@lean-apple lean-apple deleted the metrics-builder branch October 14, 2025 04:58
@lean-apple
Copy link
Contributor Author

Running in dev mode and using Jaeger, I can see that all traces contain only one span, meaning every event happening on the node is "disparate" and unconnected to other events. How I imagine it should (?) be is that every block (or another unit of work) has a trace that is propagated through all events down stream: block building, state root calculation, executing the block, etc.

@Zygimantass I'm not sure right now there is a full propagation of spans and if the tracing context is kept so, which would help to have less disparate events on jaeger and enable to follow to full workflow.

@jenpaff jenpaff moved this from Done to Completed in Reth Tracker Oct 20, 2025
frisitano added a commit to scroll-tech/reth that referenced this pull request Nov 17, 2025
* docs: yellowpaper sections in consensus implementation (paradigmxyz#18881)

* fix(era-utils): fix off-by-one for Excluded end bound in process_iter (paradigmxyz#18731)

Co-authored-by: Roman Hodulák <roman.hodulak@polyglot-software.com>

* refactor: eliminate redundant allocation in precompile cache example (paradigmxyz#18886)

* chore: relax `ChainSpec` impls (paradigmxyz#18894)

* chore: make clippy happy (paradigmxyz#18900)

* fix(trie): Reveal extension child when extension is last remaining child of a branch (paradigmxyz#18891)

* chore(node): simplify EngineApiExt bounds by removing redundant constraints (paradigmxyz#18905)

* refactor(engine): separate concerns in on_forkchoice_updated for better maintainability (paradigmxyz#18661)

Co-authored-by: Nathaniel Bajo <nathanielbajo@Nathaniels-MacBook-Pro.local>
Co-authored-by: YK <chiayongkang@hotmail.com>
Co-authored-by: Brian Picciano <me@mediocregopher.com>

* feat(provider): add get_account_before_block to ChangesetReader (paradigmxyz#18898)

* refactor: replace collect().is_empty() with next().is_none() in tests (paradigmxyz#18902)

Co-authored-by: Alexey Shekhirin <5773434+shekhirin@users.noreply.github.com>

* ci: cache hive simulator images to reduce prepare-hive job time (paradigmxyz#18899)

* docs: duplicate comment in Eip4844PoolTransactionError (paradigmxyz#18858)

* chore: align node_config threshold constant (paradigmxyz#18914)

* feat: wait for new blocks when build is in progress (paradigmxyz#18831)

Co-authored-by: Roman Hodulák <roman.hodulak@polyglot-software.com>

* perf(tree): worker pooling for storage in multiproof generation (paradigmxyz#18887)

Co-authored-by: Brian Picciano <me@mediocregopher.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Alexey Shekhirin <5773434+shekhirin@users.noreply.github.com>

* chore(grafana): use precompile address as legend (paradigmxyz#18913)

* refactor: remove needless collect() calls in trie tests (paradigmxyz#18937)

* fix(examples): change method to launch with debug capabilities (paradigmxyz#18946)

* fix(example): launch with debug capabilities (paradigmxyz#18947)

* fix(testsuite): Fix unused updates in e2e-test-utils (paradigmxyz#18953)

* fix(payload): correct Debug label for PayloadTimestamp in PayloadServiceCommand (paradigmxyz#18954)

* chore(rpc): Moves `SequencerMetrics` into `reth-optimism-rpc` (paradigmxyz#18921)

* refactor: replace println! with structured logging in test_vectors (paradigmxyz#18956)

* refactor(cli): use structured logging (tracing) in p2p command (paradigmxyz#18957)

* perf(tree): add elapsed time to parallel state root completion log (paradigmxyz#18959)

* fix(trie): Properly upsert into StoragesTrie in repair-trie (paradigmxyz#18941)

* fix: misleading error message in db list: show actual table name (paradigmxyz#18896)

* fix: remove noisy stderr prints in ERA1 cleanup (EraClient::delete_outside_range) (paradigmxyz#18895)

* fix: use max B256 for upper bound in empty-storage check (paradigmxyz#18962)

* ci: remove reproducible build from release.yml (paradigmxyz#18958)

* chore(rpc): Remove redundant U256::from in suggested_priority_fee (paradigmxyz#18969)

* chore(ci): update eest 7594 issue link in hive expected failures file (paradigmxyz#18976)

* perf(tests): remove redundant format! in ef-tests run_only (paradigmxyz#18909)

* feat(cli): enable traces export via `tracing-otlp` cli arg (paradigmxyz#18242)

Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com>

* feat: allow otlp level to be configurable (paradigmxyz#18981)

* chore(optimism): remove unnecessary Debug bounds from header generics (paradigmxyz#18989)

* refactor: convert satisfy_base_fee_ids to use closure (paradigmxyz#18979)

* chore: bump otlp crates (paradigmxyz#18984)

* fix(network): prevent metric leak in outgoing message queue on session teardown (paradigmxyz#18847)

* chore: remove unused imports in blockchain_provider (paradigmxyz#18867)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>

* fix(stateless): enforce BLOCKHASH ancestor header limit (paradigmxyz#18920)

* chore(evm): mark ExecuteOutput as unused and slated for removal (paradigmxyz#18754)

* refactor: unify `Pipeline` creation codepaths (paradigmxyz#18955)

* fix(engine): flatten storage cache (paradigmxyz#18880)

* perf(tree): worker pooling for account proofs (paradigmxyz#18901)

Co-authored-by: Brian Picciano <me@mediocregopher.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Alexey Shekhirin <5773434+shekhirin@users.noreply.github.com>

* refactor(storage): fix ChainStateKey enum variant name (paradigmxyz#18992)

* refactor(trie): remove proof task manager (paradigmxyz#18934)

Co-authored-by: Brian Picciano <me@mediocregopher.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Alexey Shekhirin <5773434+shekhirin@users.noreply.github.com>

* fix: required optimism primitives features in db-api (paradigmxyz#19005)

* refactor(engine): simplify InvalidBlockWitnessHook::on_invalid_block for better testability (paradigmxyz#18696)

* chore: replace poll_next_unpin loop with poll_recv_many (paradigmxyz#18978)

* fix: Set Era pipeline stage to last checkpoint when there is no target (paradigmxyz#19000)

* ci: Add tests for Paris scenario in hive.yml (paradigmxyz#19013)

* chore: bump book timeout (paradigmxyz#19016)

* feat: add metrics for safe and finalized block heights (paradigmxyz#18987)

* chore(privitives-traits): remove unused serde derives and camelCase attribute (paradigmxyz#19014)

* chore: refactor loop in `add_new_transactions` (paradigmxyz#19006)

* chore(ci): bump hive eest to v5.3.0 (paradigmxyz#19021)

* feat(devp2p): make eth p2p networkId configurable (paradigmxyz#19020)

Co-authored-by: frankudoags <frankudoags.com>

* chore: remove unused Args struct from exex-subscription example (paradigmxyz#19019)

* feat: add pending sequence as pub (paradigmxyz#19022)

* chore: bump alloy-core (paradigmxyz#19026)

* fix: unused warnings for tracing (paradigmxyz#19025)

* fix: respect cli blob size setting (paradigmxyz#19024)

* feat(engine): deprecate TestPipelineBuilder::with_executor_results (paradigmxyz#19017)

* perf: background init of workers (paradigmxyz#19012)

* chore(ci): update expected failures (paradigmxyz#19034)

* fix: use header type generic for mask (paradigmxyz#19037)

* fix: correct `Compact` impl for `Option` (paradigmxyz#19042)

* chore: increase versioned hash index cache (paradigmxyz#19038)

* chore(primitives-traits): relax SignerRecoverable bounds for Extended<B,T> (paradigmxyz#19045)

* feat: bump revm (paradigmxyz#18999)

* fix: resolve upstream merge

Signed-off-by: Gregory Edison <gregory.edison1993@gmail.com>

* bump revm

* update deps and fix lints

* update openvm deps

* skip exex wal storage test

* pin revm tag scroll-v91

* bump openvm compat

---------

Signed-off-by: Gregory Edison <gregory.edison1993@gmail.com>
Co-authored-by: josé v <52646071+Peponks9@users.noreply.github.com>
Co-authored-by: Forostovec <ilonaforostovec22@gmail.com>
Co-authored-by: Roman Hodulák <roman.hodulak@polyglot-software.com>
Co-authored-by: Skylar Ray <137945430+sky-coderay@users.noreply.github.com>
Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
Co-authored-by: Léa Narzis <78718413+lean-apple@users.noreply.github.com>
Co-authored-by: Brian Picciano <me@mediocregopher.com>
Co-authored-by: radik878 <radikpadik76@gmail.com>
Co-authored-by: William Nwoke <willteey@gmail.com>
Co-authored-by: Nathaniel Bajo <nathanielbajo@Nathaniels-MacBook-Pro.local>
Co-authored-by: YK <chiayongkang@hotmail.com>
Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com>
Co-authored-by: Merkel Tranjes <140164174+rnkrtt@users.noreply.github.com>
Co-authored-by: Alexey Shekhirin <5773434+shekhirin@users.noreply.github.com>
Co-authored-by: Federico Gimenez <fgimenez@users.noreply.github.com>
Co-authored-by: stevencartavia <112043913+stevencartavia@users.noreply.github.com>
Co-authored-by: emmmm <155267286+eeemmmmmm@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: MIHAO PARK <wetkeyboard17@gmail.com>
Co-authored-by: Tilak Madichetti <tilak.madichetti@gmail.com>
Co-authored-by: Emilia Hane <elsaemiliaevahane@gmail.com>
Co-authored-by: maradini77 <140460067+maradini77@users.noreply.github.com>
Co-authored-by: sashaodessa <140454972+sashaodessa@users.noreply.github.com>
Co-authored-by: Alvarez <140459501+prestoalvarez@users.noreply.github.com>
Co-authored-by: MozirDmitriy <dmitriymozir@gmail.com>
Co-authored-by: drhgencer <gancer16@gmail.com>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: anim001k <140460766+anim001k@users.noreply.github.com>
Co-authored-by: Julian Meyer <julian.meyer@coinbase.com>
Co-authored-by: Karl Yu <43113774+0xKarl98@users.noreply.github.com>
Co-authored-by: Jennifer <jenpaff0@gmail.com>
Co-authored-by: Ivan Wang <314130948@qq.com>
Co-authored-by: GarmashAlex <garmasholeksii@gmail.com>
Co-authored-by: Udoagwa Franklin <54338168+frankudoags@users.noreply.github.com>
Co-authored-by: Luca Provini <luca.provini@usemerkle.com>
Co-authored-by: Galoretka <galoretochka@gmail.com>
Co-authored-by: sashass1315 <sashass1315@gmail.com>
Co-authored-by: frisitano <francesco.risitano95@gmail.com>
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Jan 22, 2026
…yz/reth#18242)

Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com>
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Feb 11, 2026
…yz/reth#18242)

Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rpc Related to the RPC implementation C-enhancement New feature or request

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

Add cli flag for enabling otlp

5 participants