Go 1.25의 flight recorder는 프로그램의 최근 실행 흔적을 낮은 오버헤드의 순환 버퍼에 보관합니다. 문제 발생 시 그 시점 주변의 스케줄링과 블로킹 흔적을 꺼내 분석할 수 있습니다.
상시 전체 추적을 저장하는 방식과 달리 오래된 기록은 새 기록에 밀립니다. 캡처 조건과 버퍼 길이를 정할 때 보고 싶은 실패 직전 구간이 남는지 확인해야 합니다.
언제 쓰나
간헐적인 동시성 지연이나 고루틴 정지를 사후 분석할 때 씁니다.
최근 실행 추적을 버퍼에 유지하다 트리거 시 꺼냅니다.
<div class="v"><header><b>FLIGHT RECORDER</b><span id="state"></span></header><main><div class="ring" id="ring"></div><div class="snapshot" id="snapshot"></div></main><footer>rolling trace until trigger</footer></div>.v{width:min(92vw,660px);height:min(86vh,310px);box-sizing:border-box;padding:clamp(9px,2.5vmin,18px);border:1px solid var(--line);border-radius:14px;background:var(--surface);display:flex;flex-direction:column;gap:7px;color:var(--fg);font:500 clamp(15px,3.2vmin,17px)/1.25 var(--font-sans, sans-serif)}.v header,.v footer{display:flex;justify-content:space-between;align-items:center;gap:8px;white-space:nowrap}.v header b{color:var(--accent);font-size:.9em}.v header span,.v footer{color:var(--muted);font-size:.82em}.v main{flex:1;min-height:0;position:relative;overflow:hidden}.v .mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.v .active{background:var(--accent)!important;color:var(--bg)!important;border-color:var(--accent)!important}.v .muted{opacity:.28} .ring{height:62%;display:flex;align-items:center;justify-content:center;gap:3px}.event{width:12%;height:38px;border:1px solid var(--line);border-radius:5px;display:grid;place-items:center;font:600 .78em ui-monospace,monospace}.snapshot{text-align:center;color:var(--accent);font:600 .82em ui-monospace,monospace}let n=0;const events=["run","wait","run","gc","wait","run"];function draw(){document.getElementById("ring").innerHTML=events.map((x,i)=>"<div class=\"event "+(i===n?"active":"")+"\">"+x+"</div>").join("");document.getElementById("snapshot").textContent=n===4?"trigger → snapshot recent events":"new event overwrites oldest";document.getElementById("state").textContent=n===4?"capture":"recording";n=(n+1)%6}draw();setInterval(draw,750)Go 1.25의 flight recorder는 프로그램의 최근 실행 흔적을 낮은 오버헤드의 순환 버퍼에 보관합니다. 문제 발생 시 그 시점 주변의 스케줄링과 블로킹 흔적을 꺼내 분석할 수 있습니다.
상시 전체 추적을 저장하는 방식과 달리 오래된 기록은 새 기록에 밀립니다. 캡처 조건과 버퍼 길이를 정할 때 보고 싶은 실패 직전 구간이 남는지 확인해야 합니다.
간헐적인 동시성 지연이나 고루틴 정지를 사후 분석할 때 씁니다.