Overview of libtrace
mainx86_64 and arm64 architectures.repository·main·Indexed 26 days ago
https://github.com/deepflowio/deepflowDeepFlow is an observability platform providing zero-code visibility into cloud-native and AI applications using eBPF and Wasm. It enables full-stack correlation across metrics, tracing, and profiling. The platform includes deepflow-agent and libtrace for kernel and userspace probing of protocols such as HTTP, gRPC, MySQL, and Redis, and supports deployment via Helm or docker-compose.
x86_64 and arm64 architectures.FlowMetrics is a daemon used to receive trident packet header statistics. It stores various types of flow and packet metrics in a time-series database.
Important Note: For all 'edge' databases (which represent bidirectional flows between two endpoints), both tx (transmitted) and rx (received) statistics are calculated from the perspective of the client.
DeepFlow is an observability platform designed for cloud-native and AI applications. It provides Zero Code data collection using eBPF for metrics, distributed tracing, request logs, and function profiling. Key capabilities include:
In deepflow-agent, data packets transition from raw bytes to application-layer structures through several key components and interfaces:
L7Protocol: Located in agent/crates/public/src/l7_protocol.rs, used to identify protocol constants.L7ProtocolParser: Located in agent/src/common/l7_protocol_log.rs, a trait used for protocol identification and parsing into L7ProtocolInfo.L7ProtocolInfo: Located in agent/src/common/l7_protocol_info.rs, the structure parsed by the parser used for session aggregation.L7ProtocolInfoInterface: Located in agent/src/common/l7_protocol_info.rs, an interface that all L7ProtocolInfo implementations must satisfy.L7ProtocolSendLog: Located in agent/src/flow_generator/protocol_logs/pb_adapter.rs, the unified structure sent to deepflow-server.Processing Flow:
L7ProtocolParser::check_payload(). If it returns true, the flow is marked with the protocol.L7ProtocolParser::parse_payload() to generate L7ProtocolInfo.L7ProtocolInfo is added to a session for request/response matching. When a match is found, L7ProtocolInfo::merge_log() is called.L7ProtocolSendLog::from(L7ProtocolInfo) and sent to the server.querier component provides a unified query language designed to bridge different types of observability data, including Metrics, Tracing, Logging, and Events.The data receiving pipeline in libtrace uses a multi-threaded approach to move data from kernel eBPF events to userspace callbacks:
perf_reader_poll function continuously monitors the perf buffer.reader_raw_cb is triggered, which uses dispatch_queue_index to enqueue data into specific ring buffers (e.g., ring 0, ring 1, ..., ring n).process_data by dequeuing data from the ring buffers using ring_sc_dequeue_burst.prefetch_and_process_data, which ultimately invokes a Rust callback function. After the callback completes, the data is freed.global.tunning configuration to optimize the agent's resource usage and execution priority.DeepFlow collects infrastructure metadata to provide context to network flows.
Metadata Sources:
deepflow-agent.k8s uses a ResourceWatcher (via ApiWatcher) to listen to the K8s API Server (list, watch). It uses ActivePoller (requires SYS_ADMIN for setns) or PassivePoller (using AF_PACKET) to sync Pod and Node MAC addresses.PlatformSynchronizer collects host information (hostname, IP) from the host.controller.cloud collects cloud-specific metadata from Cloud APIs.Metadata Storage and Sync:
gRPC (e.g., GenesisSync, KubernetesAPISync) to controller.genesis in the deepflow-server.controller.genesis and controller.cloud pass data to controller.recorder.controller.recorder writes metadata to MySQL Meta Tables.controller.tagrecorder uses metadata from MySQL to generate tags in MySQL Tag Tables.controller, querier, and ingester. These components work together to manage cloud/container resources, provide a unified query language, and handle high-performance data ingestion and tagging.The Labeler is responsible for enriching flows with metadata. It attaches two primary types of information to flows:
The DeepFlow Community Edition architecture consists of two primary components: