Audit Log Service
A platform-wide audit trail published from 12 microservices
Overview
Every admin write on the platform emits an audit event. I designed the event contract and the gRPC metadata it relies on, rewrote the shared publisher, wrote the diff utility, and built the consuming service and its query API.
Key Highlights
Kafka event contract carrying operator, IP, request path, module/action and trace IDs, plus before/after snapshots
Shared publisher now called from 12 microservices; a JSON diff utility stores only changed fields with readable labels
Consumer enriches each event with operator and target details through parallel gRPC calls
Tenant-scoped query API that hides platform-admin actions from tenants
Found a production memory leak with pprof: a value-copied RPC client opened a new gRPC connection per message
Key Implementations
Audit as a platform contract
A topic, a message schema and gRPC metadata keys that every service uses the same way, so an audit event can always name who did what, from where, and under which trace.
Why: An audit trail is only useful if every team records it consistently; a shared contract and publisher make that the default.
Result: Published from 12 services.
Memory-leak investigation
Memory grew steadily under load. I exposed pprof, read the heap profile, and found that the RPC client wrapper was passed by value, so its lazily created connection was never cached. The fix was pointer receivers, eager client initialisation and dropping large snapshot fields from the hot path.
Why: A temporary periodic GC hid the symptom; profiling found the cause.
Related
Segmentation & Loyalty Service
Customer segmentation, loyalty-tier cashback and partner rebate configuration
Notification & CRM Service
Announcements, in-app inbox and a call-centre CRM back end
Configuration & Access-Control Service
Tenant configuration, domain management and a priority-based allow/deny engine