Skip to content

Commit

Permalink
feat: adding quotas detail in asup (#3020)
Browse files Browse the repository at this point in the history
* feat: adding quotas detail in asup

* feat: Adding only PluginInstances field in asup

* feat: minor changes
  • Loading branch information
Hardikl authored Jul 2, 2024
1 parent 41c602f commit 8099c24
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 13 deletions.
2 changes: 2 additions & 0 deletions cmd/collectors/rest/plugins/qtree/qtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ func (q *Qtree) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util.
return nil, nil, err
}

q.client.Metadata.PluginInstances = uint64(quotaCount)

q.Logger.Info().
Int("numQuotas", quotaCount).
Int("metrics", numMetrics).
Expand Down
8 changes: 7 additions & 1 deletion cmd/collectors/rest/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ func (r *Rest) CollectAutoSupport(p *collector.Payload) {
InstanceInfo: &info,
})

if (r.Name == "Rest" && (r.Object == "Volume" || r.Object == "Node")) || r.Name == "Ems" {
if (r.Name == "Rest" && (r.Object == "Volume" || r.Object == "Node" || r.Object == "Qtree")) || r.Name == "Ems" {
version := r.Client.Cluster().Version
p.Target.Version = strconv.Itoa(version[0]) + "." + strconv.Itoa(version[1]) + "." + strconv.Itoa(version[2])
p.Target.Model = "cdot"
Expand Down Expand Up @@ -762,6 +762,12 @@ func (r *Rest) CollectAutoSupport(p *collector.Payload) {
if r.Object == "Volume" {
p.Volumes = &info
}
if r.Object == "Qtree" {
info = collector.InstanceInfo{
PluginInstances: md.LazyValueInt64("pluginInstances", "data"),
}
p.Quotas = &info
}
}
}

Expand Down
12 changes: 9 additions & 3 deletions cmd/collectors/zapi/collector/zapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,15 +465,16 @@ func (z *Zapi) CollectAutoSupport(p *collector.Payload) {
InstanceInfo: &info,
})

if z.Name == "Zapi" && (z.Object == "Volume" || z.Object == "Node") {
if z.Name == "Zapi" && (z.Object == "Volume" || z.Object == "Node" || z.Object == "Qtree") {
p.Target.Version = z.GetHostVersion()
p.Target.Model = z.GetHostModel()
if p.Target.Serial == "" {
p.Target.Serial = z.GetHostUUID()
}
p.Target.ClusterUUID = z.Client.ClusterUUID()

if z.Object == "Node" {
switch z.Object {
case "Node":
var (
nodeIDs []collector.ID
err error
Expand All @@ -494,8 +495,13 @@ func (z *Zapi) CollectAutoSupport(p *collector.Payload) {
p.Target.Serial = nodeIDs[0].SerialNumber
}
}
} else if z.Object == "Volume" {
case "Volume":
p.Volumes = &info
case "Qtree":
info = collector.InstanceInfo{
PluginInstances: md.LazyValueInt64("pluginInstances", "data"),
}
p.Quotas = &info
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/collectors/zapi/plugins/qtree/qtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ func (q *Qtree) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util.
}
}

q.client.Metadata.PluginInstances = uint64(quotaIndex)

q.Logger.Info().
Int("numQuotas", quotaIndex).
Int("metrics", numMetrics).
Expand Down
16 changes: 9 additions & 7 deletions cmd/poller/collector/asup.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type Payload struct {
Platform *platformInfo
Nodes *InstanceInfo `json:"Nodes,omitempty"`
Volumes *InstanceInfo `json:"Volumes,omitempty"`
Quotas *InstanceInfo `json:"Quotas,omitempty"`
Tenants *InstanceInfo `json:"Tenants,omitempty"`
Collectors *[]AsupCollector
path string
Expand All @@ -49,13 +50,14 @@ type ID struct {
}

type InstanceInfo struct {
Count int64
DataPoints int64
PollTime int64
APITime int64
ParseTime int64
PluginTime int64
Ids []ID `json:"Ids,omitempty"` // revive:disable-line var-naming
Count int64
DataPoints int64
PollTime int64
APITime int64
ParseTime int64
PluginTime int64
PluginInstances int64
Ids []ID `json:"Ids,omitempty"` // revive:disable-line var-naming
}

type Process struct {
Expand Down
2 changes: 2 additions & 0 deletions cmd/poller/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ func Init(c Collector) error {
_, _ = md.NewMetricUint64("instances")
_, _ = md.NewMetricUint64("bytesRx")
_, _ = md.NewMetricUint64("numCalls")
_, _ = md.NewMetricUint64("pluginInstances")

// Used by collector logging but not exported
loggingOnly := []string{begin, "export_time"}
Expand Down Expand Up @@ -459,6 +460,7 @@ func (c *AbstractCollector) Start(wg *sync.WaitGroup) {
if pluginMetadata != nil {
_ = c.Metadata.LazyAddValueUint64("bytesRx", task.Name, pluginMetadata.BytesRx)
_ = c.Metadata.LazyAddValueUint64("numCalls", task.Name, pluginMetadata.NumCalls)
_ = c.Metadata.LazySetValueUint64("pluginInstances", task.Name, pluginMetadata.PluginInstances)
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions pkg/util/metadata.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package util

type Metadata struct {
BytesRx uint64
NumCalls uint64
BytesRx uint64
NumCalls uint64
PluginInstances uint64
}

func (m *Metadata) Reset() {
m.BytesRx = 0
m.NumCalls = 0
m.PluginInstances = 0
}

0 comments on commit 8099c24

Please sign in to comment.