Add cron-based/manual reset to ExporterMetrics

This commit is contained in:
ionutboangiu
2025-03-14 18:51:58 +02:00
committed by Dan Christian Bogos
parent 934815d9ee
commit 1c00a3aad1
38 changed files with 286 additions and 347 deletions

View File

@@ -292,7 +292,7 @@ func TestV1ProcessEvent4(t *testing.T) {
}
func newMockEventExporter() *mockEventExporter {
return &mockEventExporter{dc: &utils.SafeMapStorage{
return &mockEventExporter{dc: &utils.ExporterMetrics{
MapStorage: utils.MapStorage{
utils.NumberOfEvents: int64(0),
utils.PositiveExports: utils.StringSet{},
@@ -301,11 +301,11 @@ func newMockEventExporter() *mockEventExporter {
}
type mockEventExporter struct {
dc *utils.SafeMapStorage
dc *utils.ExporterMetrics
bytePreparing
}
func (m mockEventExporter) GetMetrics() *utils.SafeMapStorage {
func (m mockEventExporter) GetMetrics() *utils.ExporterMetrics {
return m.dc
}
@@ -438,7 +438,7 @@ func TestOnCacheEvicted(t *testing.T) {
}
func TestUpdateEEMetrics(t *testing.T) {
dc, _ := newEEMetrics(utils.EmptyString)
dc := utils.NewExporterMetrics("", time.UTC)
tnow := time.Now()
ev := engine.MapEvent{
utils.AnswerTime: tnow,
@@ -447,7 +447,7 @@ func TestUpdateEEMetrics(t *testing.T) {
utils.ToR: utils.MetaVoice,
utils.Usage: time.Second,
}
exp, _ := newEEMetrics(utils.EmptyString)
exp := utils.NewExporterMetrics("", time.UTC)
exp.MapStorage[utils.FirstEventATime] = tnow
exp.MapStorage[utils.LastEventATime] = tnow
exp.MapStorage[utils.FirstExpOrderID] = int64(1)