Skip to content

Probe Framework and Lifecycle ​

Relevant source files

The following files were used as context for generating this wiki page:

Purpose and Scope ​

This document details the architectural framework and lifecycle management for core TLS probes (openssl and gotls) within eCapture. It covers probe factory registration, embedding and delegation via BaseProbe, configuration validation, eBPF bytecode resolution, manager attachment, event reader tracking, and graceful shutdown workflows.

Sources:


Factory Registration and Instantiation ​

Concrete probes register with the application factory and expose constructor functions that initialize probe instances with appropriate metadata and internal dispatch structures.

The OpenSSL and GoTLS probes embed base.BaseProbe and set up internal maps for routing eBPF events to their respective decoders.

Sources:


BaseProbe Lifecycle and Initialization ​

The lifecycle of any core TLS probe begins with Initialize(ctx, cfg), implemented across concrete probes by delegating shared validation and dispatcher setup to base.BaseProbe.Initialize().

During initialization, configuration validation occurs, operational loggers are configured, bytecode selection modes are resolved, and an event dispatcher is instantiated with appropriate text or publisher handlers.

Sources:


eBPF Attachment and Manager Setup ​

Once initialized, the probe's Start(ctx) method drives the loading of eBPF bytecode assets, initialization of the ebpfmanager.Manager, attachment of kprobes/uprobes, and retrieval of event maps.

The bytecode asset is selected dynamically based on BTF and build-time mode configurations, read from embedded assets, and loaded into the kernel via ebpfmanager.

Sources:


Reader Tracking and Event Decoding ​

After the eBPF manager successfully attaches probes and starts, event maps are retrieved from the manager instance and paired with corresponding decoders. StartPerfEventReader spawns background read loops to pull events from perf or ring buffers.

Sources:


Concurrency, Shutdown, and Resource Cleanup ​

Probe teardown is managed by Stop(ctx) and Close(). The BaseProbe manages running state atomically, while concrete probes ensure that the eBPF manager is stopped with manager.CleanAll to detach probes and unload maps, and file handles or readers are closed.

Sources:

Probe Framework and Lifecycle has loaded
Download