mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-11 22:10:11 +01:00
feat(usage): include pvc name in volume events
Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
parent
e558bb52cb
commit
b08a1e2a1f
10 changed files with 22 additions and 3 deletions
1
changelogs/unreleased/150-pawanpraka1
Normal file
1
changelogs/unreleased/150-pawanpraka1
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
include pvc name in volume events
|
||||||
|
|
@ -1038,6 +1038,7 @@ spec:
|
||||||
- "--strict-topology"
|
- "--strict-topology"
|
||||||
- "--enable-leader-election"
|
- "--enable-leader-election"
|
||||||
- "--leader-election-type=leases"
|
- "--leader-election-type=leases"
|
||||||
|
- "--extra-create-metadata=true"
|
||||||
env:
|
env:
|
||||||
- name: ADDRESS
|
- name: ADDRESS
|
||||||
value: /var/lib/csi/sockets/pluginproxy/csi.sock
|
value: /var/lib/csi/sockets/pluginproxy/csi.sock
|
||||||
|
|
|
||||||
|
|
@ -1038,6 +1038,7 @@ spec:
|
||||||
- "--strict-topology"
|
- "--strict-topology"
|
||||||
- "--enable-leader-election"
|
- "--enable-leader-election"
|
||||||
- "--leader-election-type=leases"
|
- "--leader-election-type=leases"
|
||||||
|
- "--extra-create-metadata=true"
|
||||||
env:
|
env:
|
||||||
- name: ADDRESS
|
- name: ADDRESS
|
||||||
value: /var/lib/csi/sockets/pluginproxy/csi.sock
|
value: /var/lib/csi/sockets/pluginproxy/csi.sock
|
||||||
|
|
|
||||||
|
|
@ -570,6 +570,7 @@ spec:
|
||||||
- "--strict-topology"
|
- "--strict-topology"
|
||||||
- "--enable-leader-election"
|
- "--enable-leader-election"
|
||||||
- "--leader-election-type=leases"
|
- "--leader-election-type=leases"
|
||||||
|
- "--extra-create-metadata=true"
|
||||||
env:
|
env:
|
||||||
- name: ADDRESS
|
- name: ADDRESS
|
||||||
value: /var/lib/csi/sockets/pluginproxy/csi.sock
|
value: /var/lib/csi/sockets/pluginproxy/csi.sock
|
||||||
|
|
|
||||||
|
|
@ -570,6 +570,7 @@ spec:
|
||||||
- "--strict-topology"
|
- "--strict-topology"
|
||||||
- "--enable-leader-election"
|
- "--enable-leader-election"
|
||||||
- "--leader-election-type=leases"
|
- "--leader-election-type=leases"
|
||||||
|
- "--extra-create-metadata=true"
|
||||||
env:
|
env:
|
||||||
- name: ADDRESS
|
- name: ADDRESS
|
||||||
value: /var/lib/csi/sockets/pluginproxy/csi.sock
|
value: /var/lib/csi/sockets/pluginproxy/csi.sock
|
||||||
|
|
|
||||||
|
|
@ -570,6 +570,7 @@ spec:
|
||||||
- "--strict-topology"
|
- "--strict-topology"
|
||||||
- "--enable-leader-election"
|
- "--enable-leader-election"
|
||||||
- "--leader-election-type=leases"
|
- "--leader-election-type=leases"
|
||||||
|
- "--extra-create-metadata=true"
|
||||||
env:
|
env:
|
||||||
- name: ADDRESS
|
- name: ADDRESS
|
||||||
value: /var/lib/csi/sockets/pluginproxy/csi.sock
|
value: /var/lib/csi/sockets/pluginproxy/csi.sock
|
||||||
|
|
|
||||||
|
|
@ -1038,6 +1038,7 @@ spec:
|
||||||
- "--strict-topology"
|
- "--strict-topology"
|
||||||
- "--enable-leader-election"
|
- "--enable-leader-election"
|
||||||
- "--leader-election-type=leases"
|
- "--leader-election-type=leases"
|
||||||
|
- "--extra-create-metadata=true"
|
||||||
env:
|
env:
|
||||||
- name: ADDRESS
|
- name: ADDRESS
|
||||||
value: /var/lib/csi/sockets/pluginproxy/csi.sock
|
value: /var/lib/csi/sockets/pluginproxy/csi.sock
|
||||||
|
|
|
||||||
|
|
@ -61,11 +61,12 @@ var SupportedVolumeCapabilityAccessModes = []*csi.VolumeCapability_AccessMode{
|
||||||
}
|
}
|
||||||
|
|
||||||
// sendEventOrIgnore sends anonymous local-pv provision/delete events
|
// sendEventOrIgnore sends anonymous local-pv provision/delete events
|
||||||
func sendEventOrIgnore(pvName, capacity, stgType, method string) {
|
func sendEventOrIgnore(pvcName, pvName, capacity, stgType, method string) {
|
||||||
if zfs.GoogleAnalyticsEnabled == "true" {
|
if zfs.GoogleAnalyticsEnabled == "true" {
|
||||||
analytics.New().Build().ApplicationBuilder().
|
analytics.New().Build().ApplicationBuilder().
|
||||||
SetVolumeType(stgType, method).
|
SetVolumeType(stgType, method).
|
||||||
SetDocumentTitle(pvName).
|
SetDocumentTitle(pvName).
|
||||||
|
SetCampaignName(pvcName).
|
||||||
SetLabel(analytics.EventLabelCapacity).
|
SetLabel(analytics.EventLabelCapacity).
|
||||||
SetReplicaCount(analytics.LocalPVReplicaCount, method).
|
SetReplicaCount(analytics.LocalPVReplicaCount, method).
|
||||||
SetCategory(method).
|
SetCategory(method).
|
||||||
|
|
@ -204,6 +205,7 @@ func (cs *controller) CreateVolume(
|
||||||
pool := helpers.GetInsensitiveParameter(¶meters, "poolname")
|
pool := helpers.GetInsensitiveParameter(¶meters, "poolname")
|
||||||
size := req.GetCapacityRange().RequiredBytes
|
size := req.GetCapacityRange().RequiredBytes
|
||||||
contentSource := req.GetVolumeContentSource()
|
contentSource := req.GetVolumeContentSource()
|
||||||
|
pvcName := helpers.GetInsensitiveParameter(¶meters, "csi.storage.k8s.io/pvc/name")
|
||||||
|
|
||||||
if err = cs.validateVolumeCreateReq(req); err != nil {
|
if err = cs.validateVolumeCreateReq(req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -221,7 +223,7 @@ func (cs *controller) CreateVolume(
|
||||||
return nil, status.Error(codes.Internal, err.Error())
|
return nil, status.Error(codes.Internal, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
sendEventOrIgnore(volName, strconv.FormatInt(int64(size), 10), "zfs-localpv", analytics.VolumeProvision)
|
sendEventOrIgnore(pvcName, volName, strconv.FormatInt(int64(size), 10), "zfs-localpv", analytics.VolumeProvision)
|
||||||
|
|
||||||
topology := map[string]string{zfs.ZFSTopologyKey: selected}
|
topology := map[string]string{zfs.ZFSTopologyKey: selected}
|
||||||
cntx := map[string]string{zfs.PoolNameKey: pool}
|
cntx := map[string]string{zfs.PoolNameKey: pool}
|
||||||
|
|
@ -268,7 +270,7 @@ func (cs *controller) DeleteVolume(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
sendEventOrIgnore(volumeID, vol.Spec.Capacity, "zfs-localpv", analytics.VolumeDeprovision)
|
sendEventOrIgnore("", volumeID, vol.Spec.Capacity, "zfs-localpv", analytics.VolumeDeprovision)
|
||||||
|
|
||||||
deleteResponse:
|
deleteResponse:
|
||||||
return csipayload.NewDeleteVolumeResponseBuilder().Build(), nil
|
return csipayload.NewDeleteVolumeResponseBuilder().Build(), nil
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ func (u *Usage) Send() {
|
||||||
gaClient.ClientID(u.clientID).
|
gaClient.ClientID(u.clientID).
|
||||||
CampaignSource(u.campaignSource).
|
CampaignSource(u.campaignSource).
|
||||||
CampaignContent(u.clientID).
|
CampaignContent(u.clientID).
|
||||||
|
CampaignName(u.campaignName).
|
||||||
ApplicationID(u.appID).
|
ApplicationID(u.appID).
|
||||||
ApplicationVersion(u.appVersion).
|
ApplicationVersion(u.appVersion).
|
||||||
DataSource(u.dataSource).
|
DataSource(u.dataSource).
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,9 @@ type Gclient struct {
|
||||||
// anonymous campaign source
|
// anonymous campaign source
|
||||||
campaignSource string
|
campaignSource string
|
||||||
|
|
||||||
|
// anonymous campaign name
|
||||||
|
campaignName string
|
||||||
|
|
||||||
// https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#ds
|
// https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#ds
|
||||||
// (usecase) node-detail
|
// (usecase) node-detail
|
||||||
dataSource string
|
dataSource string
|
||||||
|
|
@ -133,6 +136,12 @@ func (u *Usage) SetApplicationName(appName string) *Usage {
|
||||||
return u
|
return u
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCampaignName : set the name of the PVC or will be empty.
|
||||||
|
func (u *Usage) SetCampaignName(campaignName string) *Usage {
|
||||||
|
u.campaignName = campaignName
|
||||||
|
return u
|
||||||
|
}
|
||||||
|
|
||||||
// SetApplicationID : usecase(OpenEBS/NDM)
|
// SetApplicationID : usecase(OpenEBS/NDM)
|
||||||
func (u *Usage) SetApplicationID(appID string) *Usage {
|
func (u *Usage) SetApplicationID(appID string) *Usage {
|
||||||
u.appID = appID
|
u.appID = appID
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue