RFC-0013: Named Trace Buffers #4109
Replies: 1 comment
-
|
📝 RFC Document Updated View changes: Commit History |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
📄 RFC Doc: 0013-named-trace-buffers.md
Named Trace Buffers
Authors: @primiano
Status: Implemented
PR: #4112
Problem
Currently, when configuring a Perfetto trace, data sources reference buffers
using a 0-based index (
target_buffer: N). This index corresponds to theposition of the buffer in the
TraceConfig.buffersarray.This addressing scheme is error-prone for humans:
Decision
Add support for named buffer addressing while maintaining full backwards
compatibility with index-based addressing.
Design
Proto Changes
TraceConfig.BufferConfig gets a new optional
namefield:DataSourceConfig gets a new optional
target_buffer_namefield:Resolution Logic
When setting up a tracing session,
TracingServiceImplwill:target_bufferis set: use it (current behavior)target_buffer_nameis set: look up the index from the maptarget_buffer_nameis set but not found: return an errorBackwards Compatibility
For deploying configs that work on both old and new versions of Perfetto:
target_buffer_nameand usestarget_buffer. Works correctly.the resolved index.
This is why supporting both
target_bufferandtarget_buffer_namesimultaneously is important: it allows a single config to work across Perfetto
versions during a transition period.
Error Cases
The service will reject configs with:
target_buffer_namethat doesn't match any buffer nametarget_bufferandtarget_buffer_nameset but resolving to differentbuffers
Example
Before (index-based):
After (name-based):
With backwards compatibility:
Alternatives considered
Using only names (no index fallback)
Pro:
Con:
💬 Discussion Guidelines:
Beta Was this translation helpful? Give feedback.
All reactions