summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDylan Griffith <dyl.griffith@gmail.com>2019-04-10 06:38:27 +0000
committerJames Lopez <james@gitlab.com>2019-04-10 06:38:27 +0000
commitc239bfcb1750794ec1bf8172dfa380dea64fe4c1 (patch)
tree2e0a95a1a741e0dc76e5f166cc29a65549aaa41e /app
parentb5af30bba6a7ffdd4b054fa9c8c9b42dd91a51d7 (diff)
downloadgitlab-ce-c239bfcb1750794ec1bf8172dfa380dea64fe4c1.tar.gz
Add more info logging to cluster apps
Log events so that it's easy to see when different requests are starting.
Diffstat (limited to 'app')
-rw-r--r--app/services/clusters/applications/base_helm_service.rb14
-rw-r--r--app/services/clusters/applications/install_service.rb2
-rw-r--r--app/services/clusters/applications/patch_service.rb2
-rw-r--r--app/services/clusters/applications/upgrade_service.rb2
4 files changed, 20 insertions, 0 deletions
diff --git a/app/services/clusters/applications/base_helm_service.rb b/app/services/clusters/applications/base_helm_service.rb
index adaa68b1efb..3e7f55f0c63 100644
--- a/app/services/clusters/applications/base_helm_service.rb
+++ b/app/services/clusters/applications/base_helm_service.rb
@@ -16,6 +16,7 @@ module Clusters
error_code: error.respond_to?(:error_code) ? error.error_code : nil,
service: self.class.name,
app_id: app.id,
+ app_name: app.name,
project_ids: app.cluster.project_ids,
group_ids: app.cluster.group_ids
}
@@ -30,6 +31,19 @@ module Clusters
Gitlab::Sentry.track_acceptable_exception(error, extra: meta)
end
+ def log_event(event)
+ meta = {
+ service: self.class.name,
+ app_id: app.id,
+ app_name: app.name,
+ project_ids: app.cluster.project_ids,
+ group_ids: app.cluster.group_ids,
+ event: event
+ }
+
+ logger.info(meta)
+ end
+
def logger
@logger ||= Gitlab::Kubernetes::Logger.build
end
diff --git a/app/services/clusters/applications/install_service.rb b/app/services/clusters/applications/install_service.rb
index 5bd3623a558..1f62b3eb4de 100644
--- a/app/services/clusters/applications/install_service.rb
+++ b/app/services/clusters/applications/install_service.rb
@@ -7,8 +7,10 @@ module Clusters
return unless app.scheduled?
app.make_installing!
+ log_event(:begin_install)
helm_api.install(install_command)
+ log_event(:schedule_wait_for_installation)
ClusterWaitForAppInstallationWorker.perform_in(
ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id)
rescue Kubeclient::HttpError => e
diff --git a/app/services/clusters/applications/patch_service.rb b/app/services/clusters/applications/patch_service.rb
index 20c739af7a2..c3d317e226b 100644
--- a/app/services/clusters/applications/patch_service.rb
+++ b/app/services/clusters/applications/patch_service.rb
@@ -8,8 +8,10 @@ module Clusters
app.make_updating!
+ log_event(:begin_patch)
helm_api.update(update_command)
+ log_event(:schedule_wait_for_patch)
ClusterWaitForAppInstallationWorker.perform_in(
ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id)
rescue Kubeclient::HttpError => e
diff --git a/app/services/clusters/applications/upgrade_service.rb b/app/services/clusters/applications/upgrade_service.rb
index a0ece1d2635..c34391bc8ad 100644
--- a/app/services/clusters/applications/upgrade_service.rb
+++ b/app/services/clusters/applications/upgrade_service.rb
@@ -9,10 +9,12 @@ module Clusters
begin
app.make_updating!
+ log_event(:begin_upgrade)
# install_command works with upgrades too
# as it basically does `helm upgrade --install`
helm_api.update(install_command)
+ log_event(:schedule_wait_for_upgrade)
ClusterWaitForAppInstallationWorker.perform_in(
ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id)
rescue Kubeclient::HttpError => e