From the course: Microservices: Design Patterns

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Tracing patterns

Tracing patterns

- In a microservices-based system, call stacks can quickly get lost. Enter into the picture, tracing patterns. Tracing is one of those things that once you build it, you'll regret not having it before that time. Consider for a moment a monolithic system. All code execution, from edge to database call, was in a single process. As such, a stack trace will help you recreate the path that the service call took. In a microservices architecture, however, that is gone because calls span processes as well as the network, not just functions. Tracing gives you a way to recreate the call stack by injecting a trace identifier into every call. The tracing identifier should be injected at the edge and span all the way to the database call, or even to the database itself, if possible. By spanning the stack, you can inject the trace ID into logs, and that will help you further diagnose issues. By leveraging tracing, no call is ever lost as long as everyone honors the trace identifier. Implementations…

Contents