// PID of the process u64 addr; // Address of the goroutine } go_addr_key_t; ポイント g 構造体には通し番号 goid があるが、OBIは読まない キーは g のアドレス + PID の組だけ 中身に触れない= g のレイアウト変更に追従不要 Go goid のオフセット(実測) 1.21–1.22 +152 1.23–1.24 +160(手前に syscallbp が追加) 1.25–1.26 +152( sched が縮小)
ポイント // 起点は自分自身 int attempts = 0; do { tp_info_t *p_inv = bpf_map_lookup_elem(&go_trace_map, parent); if (!p_inv) { // 親を1段遡る(ongoing_goroutines を引く) // ... } else { return r_addr; // 開始済みトレースを発見 } attempts++; // We loop far back because some clients, e.g. Kafka Franz-Go // really nest the client calls. } while (attempts < 6); // Up to 6 levels of goroutine nesting allowed 検証器は探索回数に上限のない ループを通さない。「見つかる まで」とは書けない 起点が自分自身なので、親方向 に辿れるのは5世代分 見つからず他に引き継ぐ情報も 無ければ新しいトレースIDが振 られる