moja-global / moja-global/moja.enteric_fermentation_source

UID in Logs for each request made to the server

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Suppose there are concurrent users using the server at the same time.
One of the API calls fails. In the current logging system made with logrus identifying the exact issue will be tiresome.

Proposed solution:

  • Setup a middleware in the router file. Each API call will be assigned a Unique ID. This id will be passed around throughout the code with the help of context.
  • We can also set up a middleware that tells the exact file and line at which the code failed in the logs.
  • Maybe convert/ store the logs in JSON to make it easier to plug in ELK or some monitoring tool in the future.

I have a clue to work on the proposed solution in Echo framework. I will have to learn and implement it in Mux.
If this looks like a genuine feature do let me know, I am available for the task.
cc: @gmajan @HarrisLawYF

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the router file and the existing logrus setup, then review how request context is passed through the server. Clarify whether the required scope is request IDs, failure locations, structured JSON logs, or some combination. Done should be defined by maintainers with tests or a concrete logging example, since the issue currently proposes several optional directions.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.