mirror of
https://github.com/kyverno/policy-reporter.git
synced 2024-12-14 11:57:32 +00:00
Fix cache fallback (#369)
* Fix Cache fallback Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de> * update changelog Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de> --------- Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>
This commit is contained in:
parent
7751d895f1
commit
4d1840342b
3 changed files with 10 additions and 6 deletions
|
@ -1,8 +1,13 @@
|
|||
# Changelog
|
||||
|
||||
# Next
|
||||
* Policy Reporter v2.17.3
|
||||
* Fix handling if metric cache fallback
|
||||
|
||||
# 2.21.2
|
||||
* Policy Reporter
|
||||
* Policy Reporter v2.17.2
|
||||
* Fix ID generation for Policy Reports which using `scope` as resource reference
|
||||
* Add optional `message` metric label
|
||||
* Helm Chart
|
||||
* fix: Add chart parameters for setting `revisionHistoryLimit` [[#363](https://github.com/kyverno/policy-reporter/pull/363) by [bodgit](https://github.com/bodgit)]
|
||||
* fix: allow not setting `.Values.podSecurityContext` for kyvernoPlugin [[#361](https://github.com/kyverno/policy-reporter/pull/361) by [haraldsk](https://github.com/haraldsk)]
|
||||
|
|
|
@ -61,10 +61,7 @@ func (c *Cache) GetReportLabels(id string) []*CacheItem {
|
|||
return item.([]*CacheItem)
|
||||
}
|
||||
|
||||
return []*CacheItem{{
|
||||
Labels: make(prometheus.Labels),
|
||||
Value: 0,
|
||||
}}
|
||||
return []*CacheItem{}
|
||||
}
|
||||
|
||||
func labelHash(labels prometheus.Labels) string {
|
||||
|
|
|
@ -60,7 +60,9 @@ func CreateCustomResultMetricsListener(
|
|||
case report.Deleted:
|
||||
items := cache.GetReportLabels(newReport.GetID())
|
||||
for _, item := range items {
|
||||
decreaseOrDelete(gauge, item.Labels, item.Value)
|
||||
if len(item.Labels) > 0 {
|
||||
decreaseOrDelete(gauge, item.Labels, item.Value)
|
||||
}
|
||||
}
|
||||
|
||||
cache.Remove(newReport.GetID())
|
||||
|
|
Loading…
Reference in a new issue