diff options
author | John Cai <jcai@gitlab.com> | 2019-12-05 05:08:28 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2019-12-10 18:21:17 +0300 |
commit | 0ba7a3ff1f6636407622058cef7c07562de9e2b3 (patch) | |
tree | bb65ab6f4d31006b3010cb81363152ef0cb6395c | |
parent | c1a8ef38e514eb746bc60aa61fc2e3ff715ebacb (diff) |
Fix structured startup logging
-rwxr-xr-x | _support/test-boot | 7 | ||||
-rw-r--r-- | changelogs/unreleased/jc-fix-structured-logging.yml | 5 | ||||
-rw-r--r-- | cmd/gitaly/main.go | 11 |
3 files changed, 18 insertions, 5 deletions
diff --git a/_support/test-boot b/_support/test-boot index 1d7b19f28..61eeeef3f 100755 --- a/_support/test-boot +++ b/_support/test-boot @@ -8,6 +8,13 @@ ADDR = 'socket'.freeze def main(gitaly_dir) gitaly_dir = File.realpath(gitaly_dir) + version = IO.popen("#{File.join(gitaly_dir, 'gitaly')} -version").read + version_from_file = "Gitaly, version #{IO.read(File.join(gitaly_dir, 'VERSION')).strip}" + + # Use start_with? instead of == because the version output could use git describe, if it is a source install + # eg: Gitaly, version 1.75.0-14-gd1ecb43f + abort "\ngitaly -version failed" unless version.start_with?(version_from_file) + Dir.mktmpdir do |dir| Dir.chdir(dir) diff --git a/changelogs/unreleased/jc-fix-structured-logging.yml b/changelogs/unreleased/jc-fix-structured-logging.yml new file mode 100644 index 000000000..7ab19ab2a --- /dev/null +++ b/changelogs/unreleased/jc-fix-structured-logging.yml @@ -0,0 +1,5 @@ +--- +title: Start up log messages are now using structured logging too +merge_request: 1674 +author: +type: other diff --git a/cmd/gitaly/main.go b/cmd/gitaly/main.go index 18cc8f62c..dc6964eaa 100644 --- a/cmd/gitaly/main.go +++ b/cmd/gitaly/main.go @@ -46,11 +46,6 @@ func main() { flag.Usage = flagUsage flag.Parse() - b, err := bootstrap.New() - if err != nil { - log.WithError(err).Fatal("init bootstrap") - } - // If invoked with -version if *flagVersion { fmt.Println(version.GetVersionString()) @@ -70,6 +65,12 @@ func main() { } config.ConfigureLogging() + + b, err := bootstrap.New() + if err != nil { + log.WithError(err).Fatal("init bootstrap") + } + sentry.ConfigureSentry(version.GetVersion(), sentry.Config(config.Config.Logging.Sentry)) config.Config.Prometheus.Configure() config.ConfigureConcurrencyLimits() |