Skip to content

Commit

Permalink
fix: remove threshold from quota rest template (#3093)
Browse files Browse the repository at this point in the history
* fix: remove threshold from quota rest template

* fix: handled threshold metric in quota plugin

* fix: handled review comment

* refactor: remove stack trace

---------

Co-authored-by: Chris Grindstaff <[email protected]>
  • Loading branch information
Hardikl and cgrinds authored Aug 8, 2024
1 parent 0d2d7b4 commit 4e3945c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 12 additions & 0 deletions cmd/collectors/rest/plugins/quota/quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ func New(p *plugin.AbstractPlugin) plugin.Plugin {
}

func (q *Quota) Init() error {
if err := q.InitAbc(); err != nil {
return err
}

if q.Params.HasChildS("qtreeMetrics") {
q.qtreeMetrics = true
}
Expand All @@ -25,6 +29,14 @@ func (q *Quota) Init() error {
func (q *Quota) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util.Metadata, error) {
data := dataMap[q.Object]

// The threshold metric does not exist in REST quota template, we are adding it to maintain parity with exported ZAPI metrics
if data.GetMetric("threshold") == nil {
_, err := data.NewMetricFloat64("threshold", "threshold")
if err != nil {
q.Logger.Error().Err(err).Msg("add metric")
}
}

// Purge and reset data
instanceMap := data.GetInstances()
metricsMap := data.GetMetrics()
Expand Down
1 change: 0 additions & 1 deletion conf/rest/9.12.0/quota.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ counters:
- space.used.hard_limit_percent => disk_used_pct_disk_limit
- space.used.soft_limit_percent => disk_used_pct_soft_disk_limit
- space.used.total => disk_used
- threshold => threshold
- filter:
- show_default_records=false
- type=tree #|user|group
Expand Down

0 comments on commit 4e3945c

Please sign in to comment.