Skip to content

Reduce the verbosity of google::apis client

Igor Frenkel requested to merge reduce-pm-gcp-connector-log-verbosity into master

What does this MR do and why?

Set Google::Apis logger level to INFO to remove http debugging information emitted when calling this client. There are several callers that trigger this functionality. One of these is https://gitlab.com/gitlab-org/gitlab/-/blob/c026dae1ced963f13174631accf90343facc53ca/ee/lib/gitlab/package_metadata/connector/gcp.rb

Related

Internal slack thread: https://gitlab.slack.com/archives/CKWHYU7U2/p1719440907568319

Verification Steps

Run the following in your bash shell.

for ll in {debug,info,warn,error,fatal,unknown}; do
  GITLAB_LOG_LEVEL=$ll bundle exec rails runner "sync_config = PackageMetadata::SyncConfiguration.new('licenses', 'gcp',  PackageMetadata::SyncConfiguration::Location::LICENSES_BUCKET, 'v2', 'cargo'); Gitlab::PackageMetadata::Connector::Gcp.new(sync_config).send(:bucket).files; nil" 2>/dev/null
  last=$(tail -n1 log/application_json.log | jq -c '.message |= .[0:100] | [.time, .message]')
  echo "log level: '$ll' last line logged was '$last'"
  echo '{}' >> log/application_json.log
done

The above will show the google api client logging only when the log level is set to debug and there will be no more output logged to log/development.log

Edited by Igor Frenkel

Merge request reports

Loading