Skip to content

Tracing celo v2.1.x#444

Open
alvarof2 wants to merge 9 commits intorelease/celo-v2.1.xfrom
tracing-celo-v2.1.x
Open

Tracing celo v2.1.x#444
alvarof2 wants to merge 9 commits intorelease/celo-v2.1.xfrom
tracing-celo-v2.1.x

Conversation

@alvarof2
Copy link
Member

@alvarof2 alvarof2 commented Nov 21, 2025

Note

Adds OpenTelemetry tracing with CLI configuration, spans for RPC/Engine API/transactions, and HTTP trace context propagation, plus required deps.

  • Tracing (OpenTelemetry) Integration:
    • New tracing package: config, tracer init/shutdown, span helpers (StartRPCSpan, StartSendRawTransactionSpan, StartTxForwardSpan, error/status setters, HTTP context inject/extract).
    • CLI flags (utils/TracingFlags) to configure tracing (endpoint, service name/version, sample rate, timeouts, feature toggles).
    • Initialize tracing in cmd/geth/config.go during node setup via utils.SetTracing.
  • RPC Layer:
    • Start spans around JSON-RPC calls (including Engine API), attach request/peer HTTP attributes, and mark errors.
    • Extract inbound HTTP trace context in rpc/http.go; helper NewContextWithTraceHeaders.
  • Transactions:
    • Trace eth_sendRawTransaction and OP sequencer forwarding with transaction attributes and error tagging.
  • CLI/Main:
    • Expose tracing flags in cmd/geth/main.go.
  • Dependencies:
    • Add OpenTelemetry modules; adjust some versions (e.g., jwt, uuid).

Written by Cursor Bugbot for commit 9b93e98. This will update automatically on new commits. Configure here.

kailuo-uniswap and others added 4 commits November 21, 2025 15:45
- Add comprehensive tracing for RPC calls and transactions
- Support W3C TraceContext header propagation
- Add Engine API tracing for op-node correlation
- Add CLI flags for tracing configuration
- Compatible with op-geth v1.101503.4

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 11

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

return nil
}

return initializeTracer(cfg)
Copy link

Choose a reason for hiding this comment

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

Bug: Race condition in tracer initialization

The Initialize function modifies global variables (tracer, isEnabled, config) without synchronization, while GetTracer uses sync.Once to call Initialize(nil) if the tracer is uninitialized. This creates a race condition where Initialize can be called explicitly from makeFullNode while concurrent goroutines call GetTracer, leading to potential data races on the global variables. The tracerOnce only protects the lazy initialization path, not the explicit initialization.

Fix in Cursor Fix in Web

// Simple parsing - in production, you might want more robust parsing
// Format: "key1=value1,key2=value2"
return headers
} No newline at end of file
Copy link

Choose a reason for hiding this comment

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

Bug: Empty parseHeaders function ignores input parameter

The parseHeaders function accepts a headerStr parameter but always returns an empty map without parsing it. This causes the OTEL_EXPORTER_OTLP_HEADERS environment variable to be silently ignored in ExtractTraceContext, preventing users from configuring custom headers for the OTLP exporter through environment variables.

Fix in Cursor Fix in Web

cfg.Endpoint = ctx.String(TracingEndpointFlag.Name)
if cfg.Endpoint != "" {
cfg.Enabled = true // Auto-enable if endpoint is provided
}
Copy link

Choose a reason for hiding this comment

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

Bug: Endpoint flag overrides explicit tracing disable

When a user explicitly sets --tracing.enabled=false but also provides --tracing.endpoint, the auto-enable logic unconditionally sets cfg.Enabled = true if the endpoint is non-empty. This overrides the user's explicit intent to disable tracing, making it impossible to disable tracing when an endpoint is configured. The auto-enable should only apply when the enabled flag hasn't been explicitly set.

Fix in Cursor Fix in Web

@alvarof2 alvarof2 changed the base branch from release/celo-v2.1.x to celo-rebase-14 November 21, 2025 16:48
@alvarof2 alvarof2 changed the base branch from celo-rebase-14 to release/celo-v2.1.x November 21, 2025 16:49
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff
github.com/gofrs/flock v0.8.1
github.com/golang-jwt/jwt/v4 v4.5.2
github.com/golang-jwt/jwt/v4 v4.5.1
Copy link

Choose a reason for hiding this comment

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

Bug: Dependency version downgrade may break compatibility

The github.com/golang-jwt/jwt/v4 dependency is downgraded from v4.5.2 to v4.5.1. This downgrade could reintroduce bugs or security issues that were fixed in v4.5.2, potentially affecting JWT authentication for the Engine API and other authenticated endpoints.

Fix in Cursor Fix in Web

@Underfeed9421
Copy link

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b93e9860f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +95 to +97
if !GetConfig().IsTransactionTracingEnabled() {
return ctx, oteltrace.SpanFromContext(ctx)
}

Choose a reason for hiding this comment

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

P1 Badge Return a no-op span when tx tracing is disabled

When transaction tracing is off (the default), this path returns oteltrace.SpanFromContext(ctx), which is the current active span rather than a fresh no-op span. Both TransactionAPI.SendRawTransaction and EthAPIBackend.SendTx immediately defer span.End(), so in requests that already have an RPC span, those defers can end the parent span early and cause later status/attribute updates in rpc/handler.go to be dropped or mis-timed; this breaks trace correctness whenever tracing is enabled but tracing.transactions is false.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants