« All posts

Go 1.25'te Flight Recorder: Sorun Anında Trace Yakalama

Go 1.25 ile gelen flight recorder, uzun süre çalışan servislerde performans sorunlarını son saniyelere ait execution trace ile teşhis etmeyi sağlıyor.

Building on the enhanced execution tracer introduced in 2024, the Go team has shipped the flight recorder feature in Go 1.25. Available through the runtime/trace package, it differs from the classic Start/Stop tracing model by continuously buffering trace data in memory in a rolling window. When a problem is detected, the program can snapshot the last few seconds of buffered trace data on demand, capturing valuable diagnostic information even in services that run for weeks without needing to know in advance when an issue will occur.

The post illustrates this with a simple "guess the number" HTTP server example, where most requests complete in microseconds but some occasionally exceed 100 milliseconds. Developers configure the recorder using trace.NewFlightRecorder with MinAge (how long trace data is reliably retained) and MaxBytes (buffer size to bound memory usage), then call WriteTo to dump a snapshot to a file as soon as a slow response is detected.

This approach makes it much easier to diagnose intermittent, hard-to-reproduce production performance issues. Instead of requiring heavy infrastructure for fleet-wide random trace sampling, flight recording enables targeted, precise data capture focused exactly on the problematic time window, meaningfully strengthening the observability toolkit for long-running Go services.

» SourceThe Go Blog