HUATUO Observability Platform

repository·main·Indexed 21 days ago

https://github.com/ccfos/huatuo

A kernel-level observability platform for cloud-native and AI infrastructure using eBPF, kprobe, tracepoint, and ftrace. It provides low-overhead insights into Linux kernel subsystems (MM, CPU scheduling, networking, block I/O) and heterogeneous hardware. The ecosystem includes the huatuo-bamai package, huatuo-apiserver for job and agent management, and the dropwatch CLI for monitoring kernel packet drops. Supports Linux kernel 4.18 and later across various distributions including Ubuntu, CentOS, OpenEuler, and Fedora.

Tokens
145.7K
Snippets
340
Records
484
Agent score
75%

What's inside HUATUO

  1. Overview of HUATUO

    main
    HUATUO (华佗) is an open-source operating system deep observability project incubated by the CCF (China Computer Society) and open-sourced by DiDi. It is designed to provide kernel-level deep observability capabilities for complex cloud-native general computing, AI computing, and bare-metal infrastructure services.
  2. Overview of HUATUO Instant Observability

    main

    HUATUO provides real-time, kernel-level deep observability for Linux systems using eBPF technology. It hooks into kernel functions (kprobes) or tracepoints to capture anomalous events across core subsystems like CPU scheduling, memory management, the network stack, and hardware reliability.

    Key Advantages over traditional logging (dmesg/syslog):

    • Reduced Data Loss: Uses eBPF and perf event ring buffers to avoid log buffer overflows.
    • Transient Event Capture: Detects anomalies that may never be written to standard kernel logs (e.g., excessive softirq disable time).
    • Cloud-Native Context: Provides container-level event correlation (cgroups, container IDs) for precise root-cause analysis in Kubernetes environments.
  3. What is HUATUO

    main

    HUATUO (华佗) is an open-source deep observability project for operating system kernels, incubated by the China Computer Federation (CCF) and open-sourced by DiDi. It is designed for general computing, AI computing, intelligent driving systems, and bare-metal services.

    By integrating Linux kernel dynamic tracing technologies such as kprobe, tracepoint, ftrace, and eBPF, HUATUO provides multi-dimensional kernel insights, including:

    • Fine-grained metrics.
    • Event-driven kernel runtime context capture for abnormal events.
    • Intelligent automated tracing.

    It is designed to provide high-granularity, low-overhead observability using eBPF technology.

  4. Overview of HUATUO Hardware Event Monitoring

    main

    HUATUO monitors Linux kernel hardware error events (RAS - Reliability, Availability, and Serviceability) with zero instrumentation overhead. It uses eBPF to observe kernel subsystems like MCE, EDAC, ACPI GHES, and PCIe AER. When an event occurs, HUATUO:

    1. Captures the raw event via eBPF tracepoints.
    2. Writes the event to a BPF Perf Event Buffer.
    3. Parses the event in user-space into a structured record.
    4. Persists the record locally (to huatuo-local) or to a remote store (e.g., Elasticsearch/OpenSearch).
    5. Exposes metrics as Prometheus counters for alerting and visualization.
  5. What is HUATUO and its key features

    main

    HUATUO is a cloud-native operating system observability project that provides kernel-level insights using eBPF, kprobe, tracepoint, and ftrace. It is designed for general-purpose cloud-native, AI, and bare-metal infrastructure.

    Core Capabilities:

    • Kernel-Wide Insight: Low-overhead (<1%) observability into MM, CPU scheduling, networking, and block I/O.
    • Instant Observability: Event-driven runtime context capture (e.g., on page faults or scheduling delays).
    • AutoTracing: Automated snapshot retention to resolve performance jitters (CPU spikes, I/O surges, etc.).
    • Continuous Profiling: Ongoing profiling of CPU, Memory, I/O, and Locks.
    • Hardware Support: Covers CPUs, memory, PCIe, network, storage, and AI accelerators (GPUs/NPUs).
    • Ecosystem Integration: Works with Prometheus, Grafana, Pyroscope, and Elasticsearch, and automatically associates K8s container labels/annotations.
  6. Overview of HUATUO Hardware Fault Diagnosis

    main

    HUATUO monitors Linux kernel hardware error events using a zero-intrusion, low-overhead approach. It leverages eBPF technology to observe kernel subsystems (MCE, EDAC, ACPI GHES, and PCIe AER) via tracepoints.

    Key capabilities include:

    • Real-time monitoring: Captures hardware errors as they occur.
    • Structured storage: Persists error events (including timestamps, device IDs, error types, and raw register values) to local directories or remote storage like ES/OS.
    • Prometheus integration: Exposes error counts as Prometheus metrics for alerting and visualization.

    Supported Scenarios:

    • General Computing: Detecting memory ECC errors (CE) to prevent DIMM failure.
    • AI Computing: Monitoring PCIe AER events for GPUs, NVLink, and RDMA NICs to isolate faulty nodes.
    • Storage Services: Monitoring PCIe NVMe/HBA errors (e.g., Completion Timeout) to diagnose performance jitter.
    • Compliance: Maintaining structured hardware health logs for auditing.
  7. Overview of the standalone `profiler` CLI

    main

    The profiler CLI is a standalone tool for performance profiling that does not require huatuo-apiserver, Elasticsearch, or Grafana. It samples host processes or processes inside containers and outputs call stacks as folded stacks or SVG flame graphs.

    Supported Languages & Mechanisms:

    • C, C++, Go: Uses an eBPF-based native collector for CPU, virtual memory, physical memory, and residency.
    • Java: Uses async-profiler for CPU, object allocation, and live objects.
    • Python: Uses py-spy for CPU profiling.

    Key Capabilities:

    • Locate CPU Hotspots: Identify primary CPU consumers via stack width.
    • Native Memory Attribution: Distinguish between virtual address-space, physical page allocation, and resident memory growth.
    • JVM Analysis: Identify high allocation rates (GC pressure) or objects that remain referenced (live objects).
    • Container Profiling: Use a container_id to profile workloads inside Docker or containerd.
  8. Overview of HUATUO Exception Event Diagnosis

    main

    HUATUO is an operating system deep observability project based on eBPF technology. It provides real-time monitoring of core Linux kernel subsystems, including CPU scheduling, memory, network protocols, and hardware errors.

    How it works

    When the kernel triggers an exception (e.g., softlockup, OOM, or hardware MCE), HUATUO uses eBPF programs to hook into kernel functions (kprobe) or tracepoints. It captures immediate context such as process information, kernel call stacks, and network context. This data is passed via perf event ring buffers to user-space handlers and persisted to Elasticsearch or local disk files.

    Key Advantages over dmesg/syslog

    • Lower Data Loss Risk: Unlike kernel log buffers which can overflow, eBPF event observation minimizes the risk of losing critical events.
    • Captures Transient Exceptions: It can capture short-lived anomalies that are never written to kernel logs (e.g., extended softirq disablement times).
    • Cloud-Native Awareness: Provides container-level event correlation, allowing for precise identification of problematic containers in Kubernetes environments.
  9. Use the standalone profiler CLI

    main

    The profiler CLI tool allows for direct sampling of host or container processes without requiring huatuo-apiserver, Elasticsearch, or Grafana. It supports C, C++, Go, Java, and Python.

    Key Capabilities:

    • CPU Profiling: Uses eBPF for native processes; uses async-profiler (Java) or py-spy (Python) for managed languages. Can use --cpuid to limit sampling to specific CPUs.
    • Memory Profiling (Native): For C, C++, and Go, it can observe virtual_alloc (address space), physical_alloc (physical page allocation), and physical_usage (current resident set).
    • JVM Analysis: Supports object allocation and object usage (surviving objects) via async-profiler.
    • Container Support: Automatically resolves target processes via Container ID.
  10. Monitor Kernel-Wide Metrics with huatuo-bamai

    main
    The huatuo-bamai package provides kernel-wide insights through various metrics. The current version supports monitoring CPU run queue latency (both for containers and the host), SoftIRQ latency, and CPU system utilization. These metrics are exposed as gauges, typically intended for consumption by monitoring systems like Prometheus.
  11. Overview of dropwatch for network drop monitoring

    main

    What is dropwatch?

    dropwatch is a kernel network drop observability tool provided by HUATUO. It attaches to the kernel tracepoint tracepoint/skb/kfree_skb to capture network drop events in real time.

    Captured Context

    When a drop occurs, dropwatch outputs the following context:

    • Protocol type
    • IP five-tuple
    • Process name and PID
    • Network device and MAC address
    • The complete kernel call stack that triggered the drop

    Performance and Filtering

    • Kernel-side filtering: Supports tcpdump-style filter expressions. The logic is compiled into eBPF bytecode at load time using the internal/pcapfilter compiler.
    • Efficiency: Filtering is performed entirely in kernel mode; only matching packets are reported to user space, minimizing host performance impact.
    • Additional Controls: Supports device whitelist/blacklist filtering, global per-second rate limiting, and integration with huatuo-bamai for Elasticsearch storage.
  12. Overview of HUATUO Storage Services

    main

    HUATUO supports persisting collected Linux kernel events and AutoTracing data to external storage backends. Currently, it supports Elasticsearch and OpenSearch.

    When events are collected, they are serialized into JSON and written simultaneously to:

    1. A local node directory (huatuo-local/) for local redundancy.
    2. The configured remote storage backend for long-term persistence and structured querying.

    Using an external backend provides several advantages over local storage:

    • Data Persistence: Distributed storage supports long-term retention beyond local disk limits.
    • Querying: Enables full-text search, field filtering, and time-range aggregation.
    • Visualization: Direct integration with platforms like Grafana and Kibana.
    • Centralization: Allows cross-node queries by aggregating data from multiple nodes into a single location.