feat(analytics): adding google analytics for ZFSPV

Whenever a volume is provisioned and de-provisioned we will send a google event with mainly following details :
1.    pvName (will shown as app title in google analytics)
2.    size of the volume
3.    event type : volume-provision, volume-deprovision
4.    storage type zfs-localpv
5.    replicacount as 1
6.    ClientId as default namespace uuid

Apart from this, we send the event once in 24 hr, which will have some info like number of nodes, node type, kubernetes version etc.

This metric is cotrolled by OPENEBS_IO_ENABLE_ANALYTICS env. We can set it to false if we don't want to send the metrics.

Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
Pawan 2020-02-26 11:31:24 +05:30 committed by Kiran Mova
parent 0fc86d843b
commit d608dbacd8
28 changed files with 1731 additions and 18 deletions

View file

@ -30,6 +30,8 @@ const (
//
// This environment variable is set via kubernetes downward API
OpenEBSNamespaceKey string = "OPENEBS_NAMESPACE"
// This environment variable is set via env
GoogleAnalyticsKey string = "OPENEBS_IO_ENABLE_ANALYTICS"
// ZFSFinalizer for the ZfsVolume CR
ZFSFinalizer string = "zfs.openebs.io/finalizer"
// ZFSVolKey for the ZfsSnapshot CR to store Persistence Volume name
@ -50,6 +52,9 @@ var (
// NodeID is the NodeID of the node on which the pod is present
NodeID string
// should send google analytics or not
GoogleAnalyticsEnabled string
)
func init() {
@ -62,6 +67,8 @@ func init() {
if NodeID == "" && os.Getenv("OPENEBS_NODE_DRIVER") != "" {
logrus.Fatalf("NodeID environment variable not set")
}
GoogleAnalyticsEnabled = os.Getenv(GoogleAnalyticsKey)
}
// ProvisionVolume creates a ZFSVolume(zv) CR,