[#111] Use request scope logger #136

Merged
alexvanin merged 1 commit from dkirillov/frostfs-s3-gw:feature/111-improve_logs_by_adding_request_id into master 2023-06-19 11:24:12 +00:00
Member

Store child zap logger with request scope fields into context.
Request scoped fields: request_id, api/method, bucket, object

Signed-off-by: Denis Kirillov d.kirillov@yadro.com

close #111

Store child zap logger with request scope fields into context. Request scoped fields: request_id, api/method, bucket, object Signed-off-by: Denis Kirillov <d.kirillov@yadro.com> close #111
dkirillov self-assigned this 2023-06-13 08:49:06 +00:00
dkirillov force-pushed feature/111-improve_logs_by_adding_request_id from 5e163212f0 to 9b9cf68602 2023-06-13 09:00:55 +00:00 Compare
dkirillov changed title from WIP: [#111] Use request scope logger to [#111] Use request scope logger 2023-06-13 09:01:55 +00:00
dkirillov requested review from storage-services-committers 2023-06-13 09:02:01 +00:00
dkirillov requested review from storage-services-developers 2023-06-13 09:02:02 +00:00
pogpp reviewed 2023-06-13 10:05:34 +00:00
api/reqinfo.go Outdated
@ -10,2 +10,4 @@
"sync"
"go.uber.org/zap"
Member

redundant line

redundant line
dkirillov force-pushed feature/111-improve_logs_by_adding_request_id from 9b9cf68602 to 73e3a55424 2023-06-14 06:08:41 +00:00 Compare
dkirillov force-pushed feature/111-improve_logs_by_adding_request_id from 73e3a55424 to 8470e0d8e4 2023-06-14 06:10:25 +00:00 Compare
alexvanin approved these changes 2023-06-14 10:52:28 +00:00
@ -40,3 +48,3 @@
zap.Error(err)}
fields = append(fields, additional...)
h.log.Error("call method", fields...)
h.log.Error("reqeust failed", fields...) // consider using h.reqLogger (it requires accept context.Context or http.Request)
Owner

Any reasons to not using h.reqLogger in this PR besides amount of refactoring?

Any reasons to not using `h.reqLogger` in this PR besides amount of refactoring?
Author
Member

No

No
api/router.go Outdated
@ -146,0 +164,4 @@
}
}
var objectMethods = []string{
Owner

This looks quite similar to RequestTypeFromAPI(). Maybe we can generalize it somehow later.

This looks quite similar to `RequestTypeFromAPI()`. Maybe we can generalize it somehow later.
dkirillov force-pushed feature/111-improve_logs_by_adding_request_id from 8470e0d8e4 to 2cb8050703 2023-06-19 08:56:28 +00:00 Compare
dkirillov force-pushed feature/111-improve_logs_by_adding_request_id from 2cb8050703 to 23593eee3d 2023-06-19 10:55:08 +00:00 Compare
alexvanin merged commit 23593eee3d into master 2023-06-19 11:24:12 +00:00
alexvanin deleted branch feature/111-improve_logs_by_adding_request_id 2023-06-19 11:24:14 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-services-developers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-s3-gw#136
No description provided.