-
Notifications
You must be signed in to change notification settings - Fork 246
feat(tracing): adding forced inclusion tracing #2997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add OpenTelemetry tracing for the core Sequencer interface. This traces all three main operations: - SubmitBatchTxs: tracks tx count and batch size - GetNextBatch: tracks tx count, forced inclusion count, batch size - VerifyBatch: tracks batch data count and verification result The tracing wrapper can be used with any Sequencer implementation (single, based, etc.) via WithTracingSequencer().
|
The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).
|
Summary of ChangesHello @chatton, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates OpenTelemetry tracing into the mechanism responsible for retrieving forced inclusion transactions from the Data Availability (DA) layer. By introducing a tracing wrapper and refactoring the retriever into an interface, the system gains improved visibility into the performance and flow of forced inclusion events, allowing for easier debugging and monitoring without altering the core retrieval logic. The tracing is enabled conditionally based on the application's instrumentation configuration. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Claude finished @chatton's task in 1m 38s —— View job Code Review Complete ✓I've completed a comprehensive review of this PR. Overall, the implementation is clean, well-structured, and follows idiomatic Go patterns. The changes successfully add OpenTelemetry tracing to the forced inclusion retriever using the decorator pattern, which aligns well with the existing tracing approach in the codebase. SummaryThis PR introduces tracing instrumentation for forced inclusion transaction retrieval by:
The implementation is solid with no blocking issues. I have a few minor suggestions for enhancement below. ✅ StrengthsArchitecture & Design:
Code Quality:
Consistency:
💡 Minor Suggestions1. Consider Adding Span Events for Key OperationsThe current implementation tracks success/failure well, but adding span events could provide richer debugging context for long-running operations. Location: Current: event, err := t.inner.RetrieveForcedIncludedTxs(ctx, daHeight)
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())
return event, err
}Suggestion: event, err := t.inner.RetrieveForcedIncludedTxs(ctx, daHeight)
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())
span.AddEvent("forced_inclusion_retrieval_failed")
return event, err
}
span.AddEvent("forced_inclusion_retrieval_completed")Rationale: Span events are useful for marking significant points in a trace timeline and can help diagnose performance issues or understand operation flow, especially when retrievals are slow due to cache misses or sync fetching. 2. Add Attribute for Epoch Boundary DetectionSince the retriever only fetches at epoch boundaries, it would be valuable to trace whether a given height represents an epoch end. Location: Suggestion: if event != nil {
span.SetAttributes(
attribute.Int64("event.start_da_height", int64(event.StartDaHeight)),
attribute.Int64("event.end_da_height", int64(event.EndDaHeight)),
attribute.Int("event.tx_count", len(event.Txs)),
attribute.Bool("event.at_epoch_end", len(event.Txs) > 0 || event.StartDaHeight != event.EndDaHeight),
)
}Rationale: This helps distinguish between "no transactions because we're not at epoch end" vs "no transactions at epoch end". It provides better observability for understanding forced inclusion patterns. 3. Trace Empty Transaction Sets More ExplicitlyWhen Location: Suggestion: if event != nil {
attrs := []attribute.KeyValue{
attribute.Int64("event.start_da_height", int64(event.StartDaHeight)),
attribute.Int64("event.end_da_height", int64(event.EndDaHeight)),
attribute.Int("event.tx_count", len(event.Txs)),
}
// Add context for empty transaction sets
if len(event.Txs) == 0 {
if event.StartDaHeight == event.EndDaHeight {
attrs = append(attrs, attribute.String("empty_reason", "not_at_epoch_end"))
} else {
attrs = append(attrs, attribute.String("empty_reason", "no_transactions_in_epoch"))
}
}
span.SetAttributes(attrs...)
}Rationale: Makes traces more self-documenting and reduces the need to correlate with logs to understand behavior. 4. Consider Adding Cache Hit/Miss InformationThe underlying retriever uses caching with fallback to sync fetching. Surfacing cache performance in traces would be valuable. Location: This would require changes to the interface or event structure Current limitation: The Suggestion (if feasible): Consider adding cache statistics to type ForcedInclusionEvent struct {
Timestamp time.Time
StartDaHeight uint64
EndDaHeight uint64
Txs [][]byte
// New fields for observability
CacheHits int
CacheMisses int
}Then in the tracing wrapper: if event != nil {
span.SetAttributes(
// ... existing attributes
attribute.Int("cache.hits", event.CacheHits),
attribute.Int("cache.misses", event.CacheMisses),
attribute.Float64("cache.hit_ratio", float64(event.CacheHits)/float64(event.CacheHits+event.CacheMisses)),
)
}Rationale: Cache performance directly impacts retrieval latency. Understanding cache behavior helps optimize prefetch window sizing and diagnose performance issues. Note: This is a bigger change that affects the data structure and would require modifications to the base retriever implementation. Consider this for a future enhancement if observability into cache performance becomes important. 🔍 Additional ObservationsError Handling:
Testing:
Documentation:
Performance:
📋 Checklist for Merge
Final VerdictStatus: Approved with minor suggestions The implementation is production-ready as-is. The suggestions above are enhancements that would improve observability but are not blockers. Consider implementing them in this PR or as follow-up improvements based on priority. Great work maintaining consistency with the existing codebase patterns! 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces OpenTelemetry tracing for the forced inclusion transaction retrieval process. This is achieved by refactoring ForcedInclusionRetriever from a struct into an interface and then applying the decorator pattern to wrap the core implementation with a tracing layer. The changes are well-structured, consistent with existing tracing patterns in the codebase, and correctly propagate the tracing context. The implementation is clean, and I found no issues with the proposed changes.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## tracing-part-11-da-submitter-v2 #2997 +/- ##
===================================================================
- Coverage 59.42% 59.26% -0.16%
===================================================================
Files 107 108 +1
Lines 10075 10103 +28
===================================================================
+ Hits 5987 5988 +1
- Misses 3458 3484 +26
- Partials 630 631 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Overview
ref #2956
Add tracing for forced inclusion