-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial setup for Request Logging in HTTP in the server side #2849
Conversation
TODO:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use everywhere interfaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going great. It'll be good to merge after certain refinements that already mentioned.
Currently, the request logger is configured in these components -
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally Looks good! Some comments (:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For deciders, have tests, else skip else.
Here is an example of grpc logging metadata - msg:"started call"
fields:<github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging_test.testDisposableFields> (length: 9)
"protocol":"grpc"
"grpc.component":"client"
"grpc.service":"grpc_middleware.testpb.TestService"
"grpc.method":"PingError"
"grpc.method_type":"unary"
"grpc.start_time":"2020-07-27T13:40:12+05:30"
"grpc.time_ms":"0.038"
"grpc.request.deadline":"2020-07-27T13:40:14+05:30"
"grpc.code":"OK"
lvl:"debug" We would want a similar metadata from the logging of http. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just a couple of nits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇 LGTM.
If @bwplotka doesn't have any major concerns, I'm happy to merge this as well.
I have changed the Decider function to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just some comments/Changelog suggestions (:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pointed out something about flag naming and the branch needs a rebase.
Review changes * Rename the logging middleware * Renamed bunch of files Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> Registered the request logging in query component Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> Modified the middleware to use the go-kit levels * Also altered the middleware API to use logging when called, rather than at time of registration Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> Remove option to log the request details into a log file Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> Made the logger a part of the logger middleware Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> Added some changes to use logger implicitly Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> Removed logging from the query UI Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> Added Request Logging in rule component * Removed request logging from the bucket component Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> Fixed a bug of multiple logging * Due to adding of contextual fields in the implicit logger. * Now we create a copy of the implicit logger before adding the contextual fields, so that every time we get a fresh set of loggers Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> Suggestions from reviewers * Renamed response_writer.go to utils.go * Moved all interfaces to option.go Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> renamed files and added a util file for serving http utilities Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> added copyright headers Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> Added a changelog Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> Added changes as suggested by reviewer * Rename ServerMiddleware to HTTPServerMiddleware * Add comments Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> added protocol field and curated the start message Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> nitpickings of request logger Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> added some changes to request logging http Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> nitpickings * changed the name of package_http to utils * made the postcall method private Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> More Nitpickings * Changed the level of logging from Info to Debug * Used contextual logging as less as possible * Return the protocol embedded in the constructor itself * Removed the logging of the request body Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> Added some more fields for making it compatible to grpc logging Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> Nitpickings * Renamed ResponseWriter with ResponseWriterWithStatus * Remove an unused function * nitpickings Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> Modified the Decision function to ENUM based decider * Currently 3 types of logging is enabled - * NoLogCall * LogStartAndFinishCall * LogFinishCall Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> changelog nits Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> added a flag in querier Signed-off-by: Yash Sharma <yashrsharma44@gmail.com> nitpickings Signed-off-by: Yash Sharma <yashrsharma44@gmail.com>
Signed-off-by: Yash Sharma <yashrsharma44@gmail.com>
Signed-off-by: Yash Sharma <yashrsharma44@gmail.com>
Signed-off-by: Yash Sharma <yashrsharma44@gmail.com>
Fixes #2844
Signed-off-by: Yash Sharma yashrsharma44@gmail.com
Changes
The current logging looks like this -
Verification