HomePhabricator

Initial setup for Request Logging in HTTP in the server side (#2849)

Authored by Yash Sharma <yashrsharma44@gmail.com> on Aug 6 2020, 2:34 PM.

Description

Initial setup for Request Logging in HTTP in the server side (#2849)

  • Add Request Logging in Thanos for HTTP Calls in server side

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>

  • nitpickings

Signed-off-by: Yash Sharma <yashrsharma44@gmail.com>

  • Added flags for request logging in ruler

Signed-off-by: Yash Sharma <yashrsharma44@gmail.com>

  • remove method name from the decider

Signed-off-by: Yash Sharma <yashrsharma44@gmail.com>

Details

Committed
GitHub <noreply@github.com>Aug 6 2020, 2:34 PM
Parents
rODTH066150a6d1e2: bump vendored cortex (#2981)
Branches
Unknown
Tags
Unknown
ChangeId
None

Event Timeline

GitHub <noreply@github.com> committed rODTH987b74670cd5: Initial setup for Request Logging in HTTP in the server side (#2849) (authored by Yash Sharma <yashrsharma44@gmail.com>).Aug 6 2020, 2:34 PM