This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Key Features

HUATUO provides resource metrics, event diagnostics, automatic tracing, and profiling. Choose a feature based on your troubleshooting goal:

Goal Documentation Main results
Check resource usage on nodes and in containers Kernel-wide Insight CPU, memory, network, storage, and accelerator metrics
Investigate past system anomalies Event Diagnostics Event times, process and container context, and call stacks
Capture diagnostics automatically when metrics indicate an anomaly Automatic Tracing Triggering metrics, CPU flame graphs, and I/O and memory diagnostics
Investigate CPU hotspots and memory allocation Continuous Profiling CPU time, wait time, and memory allocation attributed to call stacks
Investigate CPU, memory, and PCIe hardware errors Hardware Error Diagnostics RAS error counts, device identifiers, and error details

Start with resource metrics to identify the time and scope of an anomaly, then examine events or profiling results. For collection switches, thresholds, and storage settings, see Node Configuration. For task management and query settings, see API Server Configuration.

For metrics, event fields, and raw codes, see the Reference Manual.

1 - Kernel-wide Insight

Overview

HUATUO collects host and container metrics for CPU, memory, network, I/O, system events, and GPUs to help identify when an anomaly occurs, which resources are involved, and its scope.

Problem Key metrics
Busy CPUs or tasks waiting too long to be scheduled Utilization, scheduling latency, throttling, and wait ratio
Memory pressure, reclaim stalls, or allocation failures Memory state, reclaim duration, OOM, and free memory blocks
Reduced network throughput, packet drops, or connection anomalies Network interface, transmit queue, TCP, and socket statistics
Slow disk responses I/O latency distributions, throughput, and request duration
System stalls or prolonged task blocking softlockup and hungtask event counts
GPU load, memory, or device state anomalies Utilization, memory, temperature, power, and interconnect metrics

Configuration

Actual output depends on kernel interfaces, device drivers, collector switches, and filters. Some collectors are disabled by default in the repository configuration. For instructions on enabling them, see Node Configuration.

Metrics are exposed through /metrics. For full names, units, labels, examples, and measurement semantics, see the Metrics Reference. A missing metric does not imply a zero value.

CPU

Utilization measures how much CPU capacity is used; scheduling latency measures how long runnable tasks wait for a CPU. Combine these with available container CPU capacity, throttling, and wait ratio to distinguish high compute load, quota limits, and resource contention.

Host utilization is normalized by the number of online CPUs; container utilization is normalized by available CPU capacity. Host load averages and current container task counts use different observation windows and should not be compared directly.

For metrics and bucket ranges, see CPU Metrics.

Memory

Memory state metrics distinguish anonymous and file memory, as well as activity states. Reclaim duration and event counts help investigate stalls caused by memory pressure. Free memory blocks are reported by NUMA node, zone, and order to help investigate contiguous memory allocation problems.

Fields and units vary by kernel and cgroup version. Interpret page counts, byte counts, and event counts separately; some metrics depend on custom kernel interfaces. For measurement conditions, see Memory Metrics.

Network

Network interface and transmit queue metrics show throughput, backlog, and packet drops. TCP, socket, connection tracking, and ARP statistics help analyze connections and protocol resource usage.

Transmit queue backlog is not queueing latency, and aggregate error counts may already include individual error categories. Check measurement semantics to avoid double counting. For metrics and their sources, see Network Metrics.

I/O

iotracing provides disk throughput, IOPS, mean request duration, utilization, and queue length. blk_iotrace measures Q2G, Q2D, and D2C latency and IO size distributions; blk_throtl and blk_iocost report completed queue waits. blk_device_health records Block, NVMe, SCSI, and MD health events and collects read-only device evidence. XFS metrics add filesystem log and allocation state.

Latency, size, and wait metrics describe individual collection intervals. Device changes restart collection, and transition data may be omitted. For names, units, labels, startup requirements, and measurement semantics, see I/O Metrics.

System events

softlockup and hungtask counters track soft lockups and blocked tasks reported by the kernel. Count changes help identify the affected time range. For process and call stack information, see Event Diagnostics. For metric names, see System Event Metrics.

GPU

MetaX

The collector gathers GPU utilization, memory, temperature, power, PCIe, MetaXLink, ECC, and related metrics. Before enabling it, meet the device and SDK requirements and check the metax_gpu blacklist setting.

For the metric list, see MetaX Metrics.

MThreads

The collector gathers GPU, memory, power, PCIe, MTLink, and related metrics. It requires the MTML management library. After enabling the collector, use MetricCollector.Mthreads to control metric groups.

Interpret device specifications separately from current throughput. For dependencies and the metric list, see MThreads Metrics.

Ascend

Details omitted.

2 - Event Diagnostics

Overview

Event diagnostics records scheduling, memory, and network anomalies reported by the Linux kernel, along with process, container, and call stack context for later investigation. Collection primarily uses eBPF probes; network interface state changes are obtained through netlink.

Problem Events or observers
Scheduling stalls, soft lockups, or prolonged task blocking sched_tick, softlockup, hungtask
OOM or blocking during direct memory reclaim memory_oom_kill, memory_reclaim_events
Packet drops in the network stack or receive latency dropwatch, net_rx_latency
Network interface state, LACP, or transmit queue timeouts netdev_events, netdev_bonding_lacp, netdev_txqueue_timeout
TCP retransmissions See tcpshark
CPU, memory, or PCIe hardware errors See Hardware Error Diagnostics

Events provide diagnostic clues but cannot independently establish a root cause. Probe support, filtering, and rate limits affect coverage; insufficient buffer space can also cause event loss.

Configuration

Set thresholds and filters under EventTracing in huatuo-bamai.conf. For all fields, defaults, and units, see “Event tracing” in Node Configuration. The global blacklist controls whether observers are enabled.

Event records

Events are written to Elasticsearch or local files according to the storage configuration. Filter by tracer_type=event, event name, host or container, and time range to inspect process, call stack, and device information. Container fields are provided only when association succeeds.

For full JSON examples, field units, and compatibility notes, see Event Fields.

CPU scheduling

Scheduler tick interval

Observer: sched_tick.

When the interval between consecutive scheduler ticks reaches the threshold, the observer records the process and kernel stack. This helps investigate prolonged interrupt disabling, CPU stalls, or virtualization scheduling delays. Set the threshold above the normal tick period; normal NO_HZ tick suppression is filtered out.

The record captures the first tick after the delay ends. The process and call stack are not necessarily the cause of the delay. High CPU load or a softirq backlog does not itself imply tick delay.

For field details, see Event Fields.

Soft lockups

Observer: softlockup.

The observer records process, CPU, and NMI backtrace information when the kernel reports a softlockup. This information alone cannot identify the process responsible. The kernel watchdog configuration determines the trigger timing.

The reporting interval for repeated events increases from 10 minutes to a maximum of 3 hours. Event counts continue to accumulate during this interval.

For field details, see Event Fields.

Blocked tasks

Observer: hungtask.

The observer detects system hungtask events and collects kernel stacks of processes in D state (uninterruptible sleep), along with CPU backtraces.

The reporting interval for repeated events increases from 10 minutes to a maximum of 3 hours, while event counts continue to accumulate. The observer is not registered if the kernel does not expose hung_task_timeout_secs. Setting this value to 0 disables kernel hungtask detection.

For field details, see Event Fields.

Memory

OOM kills

Observer: memory_oom_kill.

The observer records the process that triggers the OOM Killer (trigger), the terminated process (victim), and available container, cgroup, and host memory information. The triggering process is not necessarily the main memory consumer; examine memory usage and limits together.

For field details, see Event Fields.

Direct reclaim

Observer: memory_reclaim_events.

The observer records the duration of a single direct memory reclaim operation by a container thread. When try_to_free_pages returns, it reports process, thread, and container information if the call exceeded the threshold, which defaults to 900 milliseconds. Events not associated with a container are filtered out.

Use the registered name memory_reclaim_events in the blacklist. Saved records use memory_reclaim as tracer_name.

For field details, see Event Fields.

Network

Network stack packet drops

Observer: dropwatch.

The observer detects packet drops in the kernel network stack and records the kernel call stack, network five-tuple, TCP state, and related information at the time of the drop. An optional call stack filter can suppress noise patterns verified on the local host.

For field details, see Event Fields.

Receive latency

Observer: net_rx_latency.

The observer measures TCP packet latency from the driver receive point to __netif_receive_skb, tcp_v4_rcv, and the user-space copy point. All three values start at the driver; they are not durations between adjacent observation points. Default thresholds are 5, 10, and 115 milliseconds, respectively. When a threshold is reached, the observer records endpoints, TCP state, sequence numbers, and latency values.

By default, the host network namespace is excluded and only container networks are observed.

For field details, see Event Fields.

Network interface state

Observer: netdev_events.

The observer subscribes to kernel netlink RTM_NEWLINK messages to detect changes in interface link state flags, such as AdminDown and CarrierDown. It records the interface name, link state, MAC address, and driver information.

At startup, the observer scans the current state of interfaces configured in EventTracing.Netdev.DeviceList to establish a baseline. It reports only subsequent state changes.

For field details, see Event Fields.

LACP state

Observer: netdev_bonding_lacp.

The observer is enabled only when an IEEE 802.3ad bonding interface exists. On LACP state changes, it records the bonding interface mode, link state, and negotiation information to help investigate link aggregation anomalies.

Use the registered name netdev_bonding_lacp in the blacklist and tracer_name=lacp when querying records.

For field details, see Event Fields.

Transmit queue timeouts

Observer: netdev_txqueue_timeout.

The observer detects network interface transmit queue timeouts and records the affected queue index, device name, and driver name. Use these records to investigate device, driver, or link problems on the transmit path.

For field details, see Event Fields.

3 - Automatic Tracing

Overview

AutoTracing starts collecting diagnostics when metrics meet configured conditions, helping investigate intermittent CPU, I/O, load, and memory anomalies. CPU spikes trigger the configured perf or profiler tool; other scenarios collect process states, call stacks, memory usage rankings, or runtime snapshots as needed.

Problem Tracer Results
Host system CPU spike cpusys Host CPU flame graph and triggering metrics
Container CPU spike cpuidle Container CPU flame graph and triggering metrics
Elevated container D-state load dload Process state statistics and kernel stacks of D-state processes
Disk I/O anomaly iotracing Process and file I/O rates, and I/O scheduling wait stacks
Host anonymous memory spike memburst Processes with the highest RSS and runtime memory snapshots

Collection starts only after a threshold is triggered, so results cannot reconstruct the full execution history before the trigger. Correlate results with the anomaly time, resource metrics, and application requests.

Configuration

Configure AutoTracing in huatuo-bamai.conf. For field defaults, units, and limits, see “Automatic tracing” in Node Configuration.

Tracer Configuration section
cpusys AutoTracing.CPUSys
cpuidle AutoTracing.CPUIdle
dload AutoTracing.Dload
iotracing AutoTracing.IOTracing
memburst AutoTracing.MemoryBurst

Before use, check the global blacklist, target container filters, and collection tool availability. Cooldown periods and scope depend on the tracer. Default thresholds in this document are built-in values; the configuration file can override them.

Node Configuration also covers interrupt utilization anomalies and container memory snapshots triggered by thresholds. This page focuses on the five tracing results listed above.

Results

Automatic tracing events are written to Elasticsearch or local files according to the enabled storage configuration. Filter by host, container, time range, and tracer, then correlate results with application requests.

For CPU collection, perf embeds flame graph data in the event. With profiler, the event retains trigger metrics; profiles are stored separately in Elasticsearch and linked by the same tracer_id. See Node Configuration for storage requirements and viewing instructions.

Common fields

Field Purpose
hostname / container_id Identify the node or container; container fields are provided only when association succeeds
tracer_name / tracer_id Identify the tracer and the individual trace
started_timestamp Correlate the trace with the anomaly time
tracer_type Set to autotracing for automatic tracing records
tracer_data Triggering metrics and collected results

For the full record structure, see Automatic Tracing Fields.

Host system CPU

Tracer: cpusys. Select the tool with AutoTracing.CPUSys.Tool (default: perf).

Host CPU sampling starts when both system CPU utilization and its increase between consecutive samples exceed their thresholds. The default thresholds are 45% and 20 percentage points, respectively, with a 30-minute cooldown.

Results include the triggering metrics and a CPU flame graph for identifying call paths with high system CPU usage.

For fields and examples, see Automatic Tracing Fields.

Container CPU

Tracer: cpuidle. Select the tool with AutoTracing.CPUIdle.Tool (default: perf).

Container-level CPU sampling starts when any one of user, system, or total CPU utilization exceeds both its utilization threshold and its increase threshold. The default cooldown is 30 minutes. AutoTracing.CPUIdle.Filter controls the target scope.

Results include utilization values, their increases, and a container CPU flame graph for examining CPU hotspots within the container.

For fields and examples, see Automatic Tracing Fields.

Container D-state load

Tracer: dload.

When the exponential moving average (EMA) of container D-state load exceeds the threshold, the tracer collects kernel stacks of D-state processes in the container and on the host. The default threshold is 5, with a 30-minute cooldown per container.

Results also include process state statistics. Use the stacks to investigate where processes block, and AutoTracing.IssuesList to mark known issues.

For fields and examples, see Automatic Tracing Fields.

Disk I/O

Tracer: iotracing.

The tracer reads /proc/diskstats every 5 seconds. Trigger conditions must hold for two consecutive sampling periods: non-NVMe devices are checked for utilization; NVMe devices must exceed both the utilization threshold and either the read or write throughput threshold. Average read and write wait times are also checked independently for each device.

Results include process and file I/O rates and I/O scheduling wait stacks, helping identify sources of I/O usage and waiting paths.

For fields and examples, see Automatic Tracing Fields.

Host anonymous memory

Tracer: memburst.

By default, the tracer samples every 10 seconds and starts evaluating conditions after collecting 60 samples. It triggers when current anonymous memory usage reaches twice the oldest value in the window and at least 70% of total host memory. The default cooldown is 30 minutes.

By default, results list the top 10 processes by RSS and attempt runtime memory snapshots for the top three to narrow the search for memory consumption. Snapshot support depends on the target runtime. Failed or unavailable captures include a status explanation; they do not mean that the process uses no memory.

For fields and examples, see Automatic Tracing Fields.

4 - Continuous Profiling

Overview

Continuous profiling attributes CPU time, wait time, and memory allocation during collection to call stacks, helping identify which code paths consume resources. Combined with resource metrics, it helps narrow an investigation from an affected node or container to functions that need inspection.

Profiling runs for a specified duration and produces periodic windows or a single result, depending on the collection mode. Manage node and container tasks through the API, or run profiler directly on the target node.

Use cases

Problem Profiling mode Diagnostic information
CPU usage rises and hotspots need investigation on-CPU CPU time consumed by each call stack
Requests slow down without high CPU usage off-CPU Call paths associated with blocking and scheduling waits
Frequent memory allocation requires investigation Native memory or Java object allocation Allocation volume and allocation call stacks
Memory usage keeps growing and live allocations need inspection Live physical pages or live Java objects Live allocation volume and allocation paths within the collection scope

Hotspots and live allocation volume provide diagnostic clues; they do not independently prove a performance bottleneck or memory leak. Interpret them alongside workload, collection scope, and time window.

Collection capabilities

CPU

Mode Supported languages Measurements
on-CPU C, C++, Go, Java, Python Call stacks sampled at the configured frequency and converted to CPU time
off-CPU C, C++, Go Blocking and scheduling wait time after a thread leaves the CPU

Native collection uses eBPF; Java uses async-profiler; Python uses py-spy. Off-CPU collection is event-driven and distinguishes blocking from run queue waits. It does not measure end-to-end application request latency.

Memory

Mode Supported languages Measurements
virtual_alloc C, C++, Go Virtual address space allocation volume
physical_alloc C, C++, Go Physical memory allocated within the collection window
physical_usage C, C++, Go Bytes in live physical pages tracked during this collection
object_alloc Java Object allocation volume and allocation call stacks
object_usage Java Live objects and allocation call stacks

Python currently supports only CPU profiling. physical_usage excludes pages allocated before collection and does not scale values by the inverse sampling probability. It cannot represent a process’s full RSS. Page-free detection and other limitations still require validation and improvement; see Profiling in Practice.

Collection methods

Method Scope Dependencies
Profiling API Remotely create, query, and stop node or container tasks huatuo-apiserver and huatuo-bamai; querying results requires Elasticsearch
profiler CLI Collect data for a target process on a node; native CPU collection also supports host or container scope A Linux collection environment and the relevant tools; local output requires neither the API service nor Elasticsearch

Supported languages, modes, and target scopes depend on the current version. Native collection also requires the necessary kernel capabilities and sampling permissions.

Results

Flame graphs

A flame graph shows call paths and their cumulative values. Width represents CPU time, wait time, or bytes in the selected memory dimension; the vertical axis represents call depth. Horizontal position does not indicate chronological order. Inspect wider frames to identify sources of resource consumption.

Host CPU flame graph and function statistics

View results in Grafana or export them locally as SVG, folded stacks, or JSON for offline analysis and further processing.

Use --output-format=tui to open an interactive terminal flame graph after collection. Press v to cycle through the graph, the full frame list, and Top Table. In the graph, Up selects the parent, Down selects the first child or returns from a leaf to the root of the current view, and Left/Right select adjacent frames at the same depth. The frame list includes frames narrower than one terminal column. Up and Down move one row at a time in the list and Top Table.

Enter zooms in, Backspace zooms out, r returns to the full graph, and / searches. Press g in the graph or frame list to group stacks by sample fields, such as cpu,comm. With a file or directory set via --output-path, pressing q saves a gob report that you can reopen by passing its path to --tui-report. Omit --output-path or use stdout or - for terminal viewing only.

Collection windows

Native CPU, native memory, and Java collection process data periodically; Python produces one result when collection ends. Window timestamps describe reception and aggregation intervals, not exact execution times for individual samples.

Live physical page usage uses the latest snapshot and must not be summed across windows. When comparing results, keep the target, mode, time range, and workload comparable.

Completeness

Task status, result publication, and sample loss statistics together determine whether results are usable. A failed task may retain some data already written. A flame graph does not prove that the task completed successfully, and empty results do not prove that no resources were consumed.

For deployment steps, task APIs, CLI examples, and result validation, see Profiling in Practice.

5 - Hardware Error Diagnostics

Overview

HUATUO records CPU, memory, and PCIe errors through kernel RAS events, providing error counts and structured details. Analyze failures using device locations, error trends, and application anomalies. A single error or an increase in counts does not by itself prove that a device is about to fail.

Collection scope

Source tracer_data.event Main information
MCE MCE CPU machine-check registers, CPU IDs, and bank numbers
EDAC EDAC Memory errors, controllers, and memory location labels
ACPI GHES NON_STANDARD Platform-specific non-standard error records and FRU information
PCIe AER AER PCIe device, error type, and TLP header
MCE threshold interrupt MCE_THRESHOLD Interrupt vector and CPU ID

Actual coverage depends on hardware, firmware, kernel tracepoints, and probe loading. Current startup checks require the ras tracepoint directory and mce/mce_record; the RAS observer does not start if either is missing. Although the decoder defines ARM GHES records, this does not establish ARM platform availability.

Kernel events pass through eBPF buffers to user space, where they are parsed into count metrics and event records:

Hardware error collection and storage flow

Configuration

Ensure that the global blacklist does not disable ras, and enable Elasticsearch or local file storage as needed. See “Hardware errors (RAS)” in Node Configuration.

EventTracing.Ras.MceThrBackoff controls the interval between saved MCE threshold interrupt events. The built-in default is 1800 seconds. Received THR events are still counted during cooldown, so count increases may differ from the number of saved records.

Results

Error counts

huatuo_bamai_ras_hw_err_total counts received RAS events by source to show error trends. It is neither the sum of err_count values in EDAC records nor the number of saved records.

Event records

Events include observation time, device, error source, severity, and source-specific details. The following example omits some fields:

{
    "tracer_name": "ras",
    "tracer_type": "event",
    "tracer_data": {
        "dev": "MEM",
        "event": "EDAC",
        "type": "Corrected",
        "info": "{\"err_count\":1,\"label\":\"CPU0_DIMM_A1\"}"
    }
}

Query by tracer_name=ras, device, and time range. info is a JSON string that requires a second parsing step; its fields vary by error source. Assess impact using device topology and error trends. A single record does not by itself prove device damage.

Severity

Type Meaning
Corrected Corrected
UncorrectedRecoverable Uncorrected, recoverable category
UncorrectedDeferred Uncorrected, deferred category
UncorrectedFatal Uncorrected, fatal category
Info Informational record
unknown Severity cannot be mapped

Severity is a classification. It does not establish that recovery succeeded, that the application was unaffected, or that a restart is required. For registers, raw code mappings, and fields by source, see Hardware Event Fields.