Skip to content

Commit

Permalink
fix: StorageGrid collector should be included in autosupport
Browse files Browse the repository at this point in the history
  • Loading branch information
cgrinds committed Feb 14, 2023
1 parent ba03a0c commit 0e8c216
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
36 changes: 19 additions & 17 deletions cmd/collectors/storagegrid/storagegrid.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,29 +535,31 @@ func (s *StorageGrid) CollectAutoSupport(p *collector.Payload) {
p.Target.Model = "storagegrid"
p.Target.ClusterUUID = s.client.Cluster.UUID

md := s.GetMetadata()
info := collector.InstanceInfo{
Count: md.LazyValueInt64("instances", "data"),
DataPoints: md.LazyValueInt64("metrics", "data"),
PollTime: md.LazyValueInt64("poll_time", "data"),
APITime: md.LazyValueInt64("api_time", "data"),
ParseTime: md.LazyValueInt64("parse_time", "data"),
PluginTime: md.LazyValueInt64("plugin_time", "data"),
}

if s.Object == "Tenant" {
if p.Nodes == nil {
nodeIds, err := s.getNodeUuids()
if err != nil {
// log the error, but don't exit method so the other info below is collected
s.Logger.Error().
Err(err).
Msg("Unable to get nodes.")
// log the error, but don't exit method so subsequent info is collected
s.Logger.Error().Err(err).Msg("Unable to get nodes.")
nodeIds = make([]collector.ID, 0)
}
info.Ids = nodeIds
p.Nodes = &collector.InstanceInfo{
Ids: nodeIds,
Count: int64(len(nodeIds)),
}
}

p.Nodes = &info
if s.Object == "Tenant" {
md := s.GetMetadata()
info := collector.InstanceInfo{
Count: md.LazyValueInt64("instances", "data"),
DataPoints: md.LazyValueInt64("metrics", "data"),
PollTime: md.LazyValueInt64("poll_time", "data"),
APITime: md.LazyValueInt64("api_time", "data"),
ParseTime: md.LazyValueInt64("parse_time", "data"),
PluginTime: md.LazyValueInt64("plugin_time", "data"),
}
p.Tenants = &info
}
}

func (s *StorageGrid) getNodeUuids() ([]collector.ID, error) {
Expand Down
5 changes: 3 additions & 2 deletions cmd/poller/collector/asup.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ type Payload struct {
Target *TargetInfo
Harvest *harvestInfo
Platform *platformInfo
Nodes *InstanceInfo
Volumes *InstanceInfo
Nodes *InstanceInfo `json:"Nodes,omitempty"`
Volumes *InstanceInfo `json:"Volumes,omitempty"`
Tenants *InstanceInfo `json:"Tenants,omitempty"`
Collectors *[]AsupCollector
path string
}
Expand Down

0 comments on commit 0e8c216

Please sign in to comment.