- Discussion
- Useful Resources
- Quick Guide
- Blue Green Deployment
- Circuit Breaker
- Service Discovery
- External Configuration
- Health Check
- Distributed Tracing
- Performance Metrics
- Log Aggregation
- Event Sourcing
- Aysynchronous Messaging
- Saga
- Command Query Responsibility Segregator
- Shared Database per Service
- Database per Service
- Branch
- Chain Of Responsibilities
- Client Side UI Composition
- Proxy
- Aggregator
- API Gateway
- Decompose by Strangler
- Decompose by Subdomain
- Decompose by Business Capability
- Microservices Design Patterns - Overview
- Microservices Design Patterns - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Distributed Tracing
Problem Statement
Microservice architecture structures an apppcation as a set of loosely coupled microservices and each service can be developed independently in agile manner to enable continous depvery/deployment. Requests often span multiple services. Using external monitoring, we can check overall response time and no. of invocations but how to get insight on inspanidual transactions/operations. A service may use databases, messaging queues, event sourcing etc. How to track scattered logs across multiple services?
Solution
We can instrument a service which is designed to perform the following operations −
Corelation ID − Generate a unique external request id per external request and pass this external id to each service involved in processing the request.
Log the Corelation ID − Each log message generated by processing service should have this correlation id.
Record the Details − Records the start/end time and other relevant details in logs when a request is processed by a service.
Searchable Logs
As logs should be placed at a centrapzed location, following diagram showcase how to use Kafka, LogStash and Kibana to aggregate logs and search the indexed logs using required filters.
Microservices generates logs, which are pubpshed using kafka log appender which then output the log messages to kafka cluster. LogStash ingests the messages from kafka, transforms the messages and pubpsh to elastic search container. Now kibana provides a visual interface to search/read indexed logs from elastic search container and provides required filters.
Advertisements