From 14113193faf2b922a3f322ff59ad9dcb46bfffd2 Mon Sep 17 00:00:00 2001 From: sai chaithanya Date: Thu, 16 Sep 2021 19:36:16 +0530 Subject: [PATCH] chore(analytic): send install event on jiva-csi controller start (#154) This commit sends install & ping events of jiva-csi controller service Signed-off-by: mittachaitu --- pkg/driver/driver.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/driver/driver.go b/pkg/driver/driver.go index e78185e..95c1b5f 100644 --- a/pkg/driver/driver.go +++ b/pkg/driver/driver.go @@ -22,6 +22,8 @@ import ( "github.com/container-storage-interface/spec/lib/go/csi" config "github.com/openebs/jiva-operator/pkg/config" "github.com/openebs/jiva-operator/pkg/kubernetes/client" + analytics "github.com/openebs/jiva-operator/pkg/usage" + "github.com/openebs/lib-csi/pkg/common/env" "github.com/sirupsen/logrus" ) @@ -95,6 +97,14 @@ func (d *CSIDriver) Run() error { s := NewNonBlockingGRPCServer(d.config.Endpoint, d.ids, d.cs, d.ns) s.Start() + + // Send Event only after starting controller. + // ControllerServer(cs) will be non-empty only if driver is running as controller service + if d.cs != nil && env.Truthy(analytics.OpenEBSEnableAnalytics) { + analytics.New().Build().InstallBuilder(true).Send() + go analytics.PingCheck() + } + s.Wait() return nil