@@ -19,11 +19,11 @@ package usage
19
19
import (
20
20
"strconv"
21
21
22
- k8sapi "github.com/openebs/lib-csi/pkg/client/k8s"
23
22
"k8s.io/klog/v2"
24
23
25
24
ga4Client "github.com/openebs/google-analytics-4/pkg/client"
26
25
ga4Event "github.com/openebs/google-analytics-4/pkg/event"
26
+ k8sapi "github.com/openebs/lib-csi/pkg/client/k8s"
27
27
)
28
28
29
29
// Usage struct represents all information about a usage metric sent to
@@ -67,44 +67,9 @@ func (u *Usage) SetCategory(c string) *Usage {
67
67
return u
68
68
}
69
69
70
- // SetAction sets the action of an event
71
- func (u * Usage ) SetAction (a string ) * Usage {
72
- u .OpenebsEventBuilder .Action (a )
73
- return u
74
- }
75
-
76
- // SetLabel sets the label for an event
77
- func (u * Usage ) SetLabel (l string ) * Usage {
78
- u .OpenebsEventBuilder .Label (l )
79
- return u
80
- }
81
-
82
- // SetValue sets the value for an event's label
83
- func (u * Usage ) SetValue (v string ) * Usage {
84
- u .OpenebsEventBuilder .Value (v )
85
- return u
86
- }
87
-
88
- // SetVolumeCapacity sets the storage capacity of the volume for a volume event
89
- func (u * Usage ) SetVolumeCapacity (volCapG string ) * Usage {
90
- s , _ := toGigaUnits (volCapG )
91
- u .SetValue (strconv .FormatInt (s , 10 ))
92
- return u
93
- }
94
-
95
- // SetReplicaCount Wrapper for setting replica count for volume events
96
- // NOTE: This doesn't get the replica count in a volume de-provision event.
97
- // TODO: Pick the current value of replica-count from the CAS-engine
98
- func (u * Usage ) SetReplicaCount (count , method string ) * Usage {
99
- if method == VolumeProvision && count == "" {
100
- // Case: When volume-provision the replica count isn't specified
101
- // it is set to three by default by the m-apiserver
102
- u .OpenebsEventBuilder .Action (DefaultReplicaCount )
103
- } else {
104
- // Catch all case for volume-deprovision event and
105
- // volume-provision event with an overridden replica-count
106
- u .OpenebsEventBuilder .Action (Replica + count )
107
- }
70
+ // SetNodes sets the node count for a k8s cluster.
71
+ func (u * Usage ) SetNodes (n string ) * Usage {
72
+ u .OpenebsEventBuilder .Nodes (n )
108
73
return u
109
74
}
110
75
@@ -149,9 +114,7 @@ func (u *Usage) InstallBuilder(override bool) *Usage {
149
114
u .OpenebsEventBuilder .
150
115
K8sDefaultNsUid (v .id ).
151
116
Category (InstallEvent ).
152
- Action (RunningStatus ).
153
- Label (EventLabelNode ).
154
- Value (strconv .Itoa (clusterSize ))
117
+ Nodes (strconv .Itoa (clusterSize ))
155
118
156
119
return u
157
120
}
0 commit comments