Microservices Observability Design Patterns

  • Health check API — Provide an endpoint that returns the health of the service.
  • Log aggregation —You can log service activity and store logs in a centralized logging server, which provides alerts and search functionality.
  • Distributed tracing — Identify each external request with a unique ID and track requests as they flow between services.
  • Exception tracking — Exceptions should be reported to an exception tracking service that de-duplicates exceptions, alerts developers, and tracks how they are resolved.
  • Application metrics — Metrics such as counters and gauges are maintained by services and exposed to metrics servers.
  • Audit logging — Keeping track of user actions

Health check API Pattern

Log Aggregation Pattern

Distributed Tracing Pattern

Application Metrics Pattern

Exception Tracking Pattern

  • Log files consist of single-line log entries, while exceptions have multiple lines.
  • In log files, there is no mechanism to track the resolution of exceptions. You would need to manually copy/paste the exception into the issue tracker.
  • There’s no way to automatically treat duplicate exceptions as one.

Audit Logging Pattern

  1. Add audit logging code to the business logic — Each service method can create an audit log entry and save it to the database.
  2. Aspect-oriented programming (AOP) — You can define advice that intercepts every service method call and persists an audit log entry using an AOP framework, like Spring AOP.
  3. Utilize event sourcing — Event sourcing by default provides an audit log for creating and updating operations.

References

--

--

--

“Walking on water and developing software from a specification are easy if both are frozen”

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Baby PHP (Web Challenge WriteUp) — hacklu CTF 2018

Technical Writing and Sports Industry

Best 7 productive tips for beginners in Web development

Best 7 productive tips for beginners in Web development

Create Azure tasks with PowerShell

Writing Alfred workflows in Go

Attention to Details : Finding Hidden IDORs

Software Development Life Cycle Series: The Waterfall Model

Weekend’s Little Humor 10 Programming Jokes of the week By Muhammad Umair

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Neeraj Kushwaha

Neeraj Kushwaha

“Walking on water and developing software from a specification are easy if both are frozen”

More from Medium

Microservices Decomposition Design Patterns

How to design sales inventory Microservice based on event-driven architecture?

Introduction to Monolithic Architecture and MicroServices ArchitectureMonolithic Architecture

Software Systems at Mizu