From 7e7fb6deba4e58b4dbbb21a8e859327cebd109d1 Mon Sep 17 00:00:00 2001 From: Dylan Griffith Date: Fri, 23 Nov 2018 16:17:17 +0100 Subject: Use JSON logging for helm install services --- .../clusters/applications/base_helm_service.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'app/services/clusters/applications/base_helm_service.rb') diff --git a/app/services/clusters/applications/base_helm_service.rb b/app/services/clusters/applications/base_helm_service.rb index 270a8eb24f4..e86ca8cf1d0 100644 --- a/app/services/clusters/applications/base_helm_service.rb +++ b/app/services/clusters/applications/base_helm_service.rb @@ -11,6 +11,25 @@ module Clusters protected + def log_error(error) + meta = { + exception: error.class.name, + error_code: error.respond_to?(:error_code) ? error.error_code : nil, + service: self.class.name, + app_id: app.id, + project_ids: app.cluster.project_ids, + group_ids: app.cluster.group_ids, + message: error.message + } + + logger.error(meta) + Gitlab::Sentry.track_acceptable_exception(error, extra: meta) + end + + def logger + @logger ||= Gitlab::Kubernetes::Logger.build + end + def cluster app.cluster end -- cgit v1.2.1