gofr icon indicating copy to clipboard operation
gofr copied to clipboard

Add response time unit in json logs

Open aryanmehrotra opened this issue 1 month ago • 4 comments

Describe the bug Right now json logs dont have the unit for the response time, latency etc but the prettyprinted logs in terminal do have, JSON logs should also have the unit to make it pretty clear for debugging purpose.

Moreover an extension to this would be keeping consistent unit across, but this needs to be thought throughly as gofr has different units, it would be for a reason.

aryanmehrotra avatar Oct 28 '25 09:10 aryanmehrotra

Can you define the scope that needs to be edited, I don't clearly understand but i want to contribute here again, sorry

0xEbrahim avatar Nov 06 '25 10:11 0xEbrahim

What purpose does this serve given we already have metrics ?

gizmo-rt avatar Nov 06 '25 11:11 gizmo-rt

@0xEbrahim we need to first decide if we want to do this as its in triage phase right now.

aryanmehrotra avatar Nov 06 '25 17:11 aryanmehrotra

@gizmo-rt

  1. Parity between json and terminal logs
  2. Metrics bucket are capped at 30 seconds, so any response time above that comes in 30s only.

aryanmehrotra avatar Nov 06 '25 17:11 aryanmehrotra

take

aaryyya avatar Nov 16 '25 14:11 aaryyya

Parity between logs is fine, though if it is solely due to metrics bucket cap then we should explore making https://github.com/gofr-dev/gofr/blob/4e9dd129983c5e5c0a6d093b863c42730a300a62/pkg/gofr/container/container.go#L262 configurable for users

gizmo-rt avatar Nov 17 '25 05:11 gizmo-rt

Parity between logs is fine

we dont have unit of time in json logs but we have them in terminal pretty printed logs

aryanmehrotra avatar Nov 19 '25 03:11 aryanmehrotra

Hi @aryanmehrotra! I’ve opened a PR to add human-readable response time units to the JSON logs while keeping the existing numeric field for backward compatibility. This improves parity between JSON logs and the pretty-printed terminal logs, and aligns with the discussion in the related issue. Whenever you get a moment, could you please review it?

DevaanshKathuria avatar Nov 25 '25 15:11 DevaanshKathuria