Skip to content

Latest commit

 

History

History
18 lines (11 loc) · 1.2 KB

README.md

File metadata and controls

18 lines (11 loc) · 1.2 KB

Batch Logger

A simple web-server made using golang and chi. The server writes logs in batchs in intervals to a post endpoint. You need to configure Batch Size, Interval Time and Post endpoint via environemnt variables.

About the codebase

There are two functioning versions of said application in the commit history. The older version was using shared memory for triggering the post endpoint syncing which could end up in race condition when throughput of input is very high and is not concurrently scalable. The newer version which is current head on master branch uses go channels for supplying logs and is taking advantage of concurrency. The insipiration for which came from this talk by Rob pyke.

Steps to run

  • run: docker build . -t batch-logger
  • create an environment file as described in sample.env or pass env variables from command line
  • run: docker run -it --rm -p 3000:3000 --env-file .env batch-logger

Endpoints

  • GET: /healthz - Returns health of the server
  • POST: /log - Send your logs here