<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Cilium on Mi&amp;Bee Blog</title><link>/en/tags/cilium/</link><description>Recent content in Cilium on Mi&amp;Bee Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>蓝宝石的傻话</managingEditor><lastBuildDate>Thu, 11 Jun 2026 00:00:00 +0000</lastBuildDate><atom:link href="/en/tags/cilium/rss.xml" rel="self" type="application/rss+xml"/><item><title>Building an OOM Killer Event Tracer with eBPF + Go</title><link>/en/posts/telemetry/ebpf-oom-tracer-cgo/</link><pubDate>Thu, 11 Jun 2026 00:00:00 +0000</pubDate><guid>/en/posts/telemetry/ebpf-oom-tracer-cgo/</guid><description>&lt;p&gt;bpftrace is great for quick probing and ad-hoc debugging. For production-grade monitoring tools, you need full eBPF programs. The architecture splits into two layers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Kernel side&lt;/strong&gt;: eBPF program written in C, attached to hook points, collecting event data&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;User side&lt;/strong&gt;: loader written in Go (or Rust / libbpf C), loading the eBPF program and reading events&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="architecture"&gt;Architecture&lt;/h2&gt;
&lt;div class="code-block-wrapper" data-lang="mermaid"&gt;
 &lt;div class="code-block-header"&gt;
 &lt;div class="code-block-meta"&gt;
 &lt;span class="code-language"&gt;mermaid&lt;/span&gt;
 &lt;/div&gt;
 &lt;/div&gt;
 &lt;div class="code-block-body"&gt;
 &lt;pre class="chroma"&gt;&lt;code class="language-mermaid"&gt;flowchart LR
 classDef kern fill:#E3F2FD,stroke:#1565C0,color:#1565C0
 classDef user fill:#FFF3E0,stroke:#E65100,color:#BF360C
 classDef data fill:#E8F5E9,stroke:#2E7D32,color:#1B5E20

 subgraph kernel[&amp;#34;Kernel Space&amp;#34;]
 hook@{ shape: rounded, label: &amp;#34;oom_kill_process (kprobe)&amp;#34; }
 ebpf@{ shape: proc, label: &amp;#34;eBPF Program\nEvent Collection&amp;#34; }
 ring@{ shape: cyl, label: &amp;#34;Ring Buffer&amp;#34; }
 end

 subgraph userspace[&amp;#34;User Space (Go)&amp;#34;]
 loader@{ shape: notch-rect, label: &amp;#34;bpf2go Loader&amp;#34; }
 reader@{ shape: proc, label: &amp;#34;RingBuf Reader\nEvent Parsing&amp;#34; }
 end

 hook --&amp;gt; ebpf --&amp;gt; ring
 ring --&amp;gt; reader
 loader -.-&amp;gt; ebpf

 class hook,ebpf,ring kern
 class loader,reader user&lt;/code&gt;&lt;/pre&gt;
 &lt;/div&gt;
&lt;/div&gt;&lt;h2 id="ebpf-kernel-program-c"&gt;eBPF Kernel Program (C)&lt;/h2&gt;
&lt;p&gt;Name the C file &lt;code&gt;oom_kprobe.bpf.c&lt;/code&gt; — the &lt;code&gt;bpf&lt;/code&gt; suffix is a cilium/ebpf convention for &lt;code&gt;bpf2go&lt;/code&gt; code generation:&lt;/p&gt;</description></item></channel></rss>