mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
ees: implement api to reset exporter metrics
This commit is contained in:
committed by
Dan Christian Bogos
parent
1c00a3aad1
commit
fdc8a1be7e
21
ees/ees.go
21
ees/ees.go
@@ -410,3 +410,24 @@ func ExportWithAttempts(exp EventExporter, eEv any, key string) (err error) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// V1ResetExporterMetricsParams contains required parameters for resetting exporter metrics.
|
||||
type V1ResetExporterMetricsParams struct {
|
||||
Tenant string
|
||||
ID string // unique identifier of the request
|
||||
ExporterID string
|
||||
APIOpts map[string]any
|
||||
}
|
||||
|
||||
// V1ResetExporterMetrics resets the metrics for a specific exporter identified by ExporterID.
|
||||
// Returns utils.ErrNotFound if the exporter is not found in the cache.
|
||||
func (eeS *EventExporterS) V1ResetExporterMetrics(ctx *context.Context, params V1ResetExporterMetricsParams, reply *string) error {
|
||||
eeCfg := eeS.cfg.EEsCfg().ExporterCfg(params.ExporterID)
|
||||
ee, ok := eeS.exporterCache[eeCfg.Type].Get(eeCfg.ID)
|
||||
if !ok {
|
||||
return utils.ErrNotFound
|
||||
}
|
||||
ee.(EventExporter).GetMetrics().Reset()
|
||||
*reply = utils.OK
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user