mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-10-21 06:37:21 +00:00
fixup! Add purging metrics on timer.
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user