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 (
log *logging.LogConfig
purgeMetricsOnCrawl bool
purgeMetricsEvery int
)
func NewMonitoring(purgeOnCrawl bool, purgeEvery int) *MetricsSetup {
@@ -34,8 +33,8 @@ func NewMonitoring(purgeOnCrawl bool, purgeEvery int) *MetricsSetup {
ms.metrics_set_custom = metrics.NewSet()
go ms.startPrometheusEndpoint()
if purgeMetricsEvery > 0 {
ticker := time.NewTicker(time.Duration(purgeMetricsEvery) * time.Second)
if purgeEvery > 0 {
ticker := time.NewTicker(time.Duration(purgeEvery) * time.Second)
go func() {
for range ticker.C {
ms.PurgeMetrics()