Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Hiltunen <shiltunen@gitlab.com>2021-03-10 15:38:57 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2021-03-10 15:38:57 +0300
commit49829c3c45153b3e875e3c6ef23bc58481d07c31 (patch)
tree8adbb3f67c2ca863dc8bcb57b940a1dfe9b445a0
parent01b9e1e009b94f4da73608338ffe2272287ac739 (diff)
parent5801b34b1b5db95159a79dfb6c2f52ac4e0fcf75 (diff)
Merge branch 'sh-gitaly-ruby-log-13-9' into '13-9-stable'
[13.9] Allow gitaly-ruby to run if log file cannot be written See merge request gitlab-org/gitaly!3236
-rw-r--r--changelogs/unreleased/sh-gitaly-ruby-log-13-9.yml5
-rwxr-xr-xruby/bin/gitaly-ruby13
2 files changed, 17 insertions, 1 deletions
diff --git a/changelogs/unreleased/sh-gitaly-ruby-log-13-9.yml b/changelogs/unreleased/sh-gitaly-ruby-log-13-9.yml
new file mode 100644
index 000000000..ba235c333
--- /dev/null
+++ b/changelogs/unreleased/sh-gitaly-ruby-log-13-9.yml
@@ -0,0 +1,5 @@
+---
+title: Allow gitaly-ruby to run if log file cannot be written
+merge_request: 3236
+author:
+type: changed
diff --git a/ruby/bin/gitaly-ruby b/ruby/bin/gitaly-ruby
index 6749f5851..d37352945 100755
--- a/ruby/bin/gitaly-ruby
+++ b/ruby/bin/gitaly-ruby
@@ -116,7 +116,10 @@ end
def build_server_interceptor_chain
chain = []
chain << Labkit::Correlation::GRPC::ServerInterceptor.new
- chain << Labkit::Logging::GRPC::ServerInterceptor.new(File.open(json_log_file, 'a'), { type: 'gitaly-ruby' })
+
+ json_logger = build_json_logger
+ chain << json_logger if json_logger
+
chain << GitalyServer::SentryInterceptor.new
chain << Labkit::Tracing::GRPC::ServerInterceptor.new if Labkit::Tracing.enabled?
chain << GitalyServer::ExceptionSanitizerInterceptor.new
@@ -125,6 +128,14 @@ def build_server_interceptor_chain
chain
end
+def build_json_logger
+ output = File.open(json_log_file, 'a')
+ Labkit::Logging::GRPC::ServerInterceptor.new(output, { type: 'gitaly-ruby' })
+rescue IOError, Errno::EACCES => e
+ GRPC.logger.warn "Unable to write to log file: #{e}"
+ nil
+end
+
def json_log_file
if Gitlab.config.logging.dir.present?
File.join(Gitlab.config.logging.dir, 'gitaly_ruby_json.log')