fixup! Add purging metrics on timer.

This commit is contained in:
2023-11-17 14:09:26 +00:00
parent 105c624426
commit a29733a52a
+2 -3
View File
@@ -23,7 +23,6 @@ type MetricsSetup struct {
var ( var (
log *logging.LogConfig log *logging.LogConfig
purgeMetricsOnCrawl bool purgeMetricsOnCrawl bool
purgeMetricsEvery int
) )
func NewMonitoring(purgeOnCrawl bool, purgeEvery int) *MetricsSetup { func NewMonitoring(purgeOnCrawl bool, purgeEvery int) *MetricsSetup {
@@ -34,8 +33,8 @@ func NewMonitoring(purgeOnCrawl bool, purgeEvery int) *MetricsSetup {
ms.metrics_set_custom = metrics.NewSet() ms.metrics_set_custom = metrics.NewSet()
go ms.startPrometheusEndpoint() go ms.startPrometheusEndpoint()
if purgeMetricsEvery > 0 { if purgeEvery > 0 {
ticker := time.NewTicker(time.Duration(purgeMetricsEvery) * time.Second) ticker := time.NewTicker(time.Duration(purgeEvery) * time.Second)
go func() { go func() {
for range ticker.C { for range ticker.C {
ms.PurgeMetrics() ms.PurgeMetrics()