Skip to content

processmanager: add TraceInterceptor extension point#1383

Open
gnurizen wants to merge 4 commits into
open-telemetry:mainfrom
gnurizen:trace-interceptor
Open

processmanager: add TraceInterceptor extension point#1383
gnurizen wants to merge 4 commits into
open-telemetry:mainfrom
gnurizen:trace-interceptor

Conversation

@gnurizen
Copy link
Copy Markdown
Contributor

@gnurizen gnurizen commented May 1, 2026

Summary

Adds an optional TraceInterceptor extension point to ProcessManager. The interceptor is invoked from HandleTrace after symbolization and before reporting; returning true consumes the trace and HandleTrace skips its default reporting path, returning false lets HandleTrace report it normally. There is no behavior change when no interceptor is installed.

type TraceInterceptor func(trace *libpf.Trace, meta *samples.TraceEventMeta) bool

The hook is intentionally a one-way handoff, not a passthrough callback. Consumers that need to report intercepted traces are expected to do so via their own downstream mechanism.

Motivation

Some symbolization sources arrive on a separate channel from the eBPF stack walker and only become available some time after the original sample. Today there is no clean way to plug additional symbolization or merging into the post-symbolization, pre-report path without forking the project. This change adds a single, narrowly-scoped hook so out-of-tree code can:

  • inspect or pass the trace through unchanged
  • consume the trace and re-emit it later (via its own reporter) once additional data has arrived.

@gnurizen gnurizen requested review from a team as code owners May 1, 2026 14:11
Comment thread processmanager/types.go
@gnurizen gnurizen closed this May 1, 2026
@gnurizen gnurizen reopened this May 1, 2026
@gnurizen gnurizen marked this pull request as draft May 1, 2026 14:41
@gnurizen gnurizen marked this pull request as ready for review May 1, 2026 14:51
@gnurizen gnurizen marked this pull request as draft May 1, 2026 15:50
Add an optional TraceInterceptor that ProcessManager.HandleTrace invokes
after symbolization and before reporting. Returning true from the
interceptor consumes the trace and the default reporting path is skipped;
returning false lets HandleTrace report it normally.

Consumers that need to report intercepted traces are expected to do so
via their own TraceReporter — the hook is intentionally a one-way handoff,
not a passthrough callback. There is no behavior change when no
interceptor is installed.

The interceptor is configured via ProcessManager.SetInterceptor, with a
pass-through Tracer.SetInterceptor for callers using the Tracer wrapper.
@gnurizen
Copy link
Copy Markdown
Contributor Author

gnurizen commented May 1, 2026

RFAL, thanks!

Comment thread processmanager/types.go Outdated
Comment thread tracer/tracer.go Outdated
Comment thread processmanager/manager.go
@gnurizen
Copy link
Copy Markdown
Contributor Author

@florianl @fabled could use another review on this one, thank in advance!

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.

2 participants