Distributed Tracing — DevOps

Distributed Tracing Di arsitektur microservices, satu user request bisa melintasi 5-10 service. Distributed tracing menghubungkan semua operasi menjadi satu tra

Distributed Tracing

Di arsitektur microservices, satu user request bisa melintasi 5-10 service. Distributed tracing menghubungkan semua operasi menjadi satu trace — sehingga kamu bisa melihat bottleneck di mana.

Context Propagation

Trace context harus di-propagate antar service via HTTP headers:

// W3C Trace Context standard
traceparent: 00-{traceId}-{spanId}-{flags}
// Contoh:
traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01

// Service A → Service B
// Header traceparent otomatis ditambahkan oleh OTel SDK
// Service B membuat child span dari parent span ID

Trace di Microservices

User → API Gateway → Order Service → Payment Service
                                    → Inventory Service
                                    → Notification Service

// Semua span terhubung via traceId yang sama
// Bisa lihat: service mana yang lambat, error di mana

Backends

Sampling

Di production, trace setiap request = terlalu banyak data. Gunakan sampling: