mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
ees: implement api to reset exporter metrics
This commit is contained in:
committed by
Dan Christian Bogos
parent
3122589e48
commit
d3adff3827
21
ees/apis.go
21
ees/apis.go
@@ -332,3 +332,24 @@ func (eeS *EeS) V1ArchiveEventsInReply(ctx *context.Context, args *ArchiveEvents
|
||||
*reply = buff.Bytes()
|
||||
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 *EeS) 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
|
||||
}
|
||||
|
||||
@@ -1855,6 +1855,7 @@ const (
|
||||
EeSv1Ping = "EeSv1.Ping"
|
||||
EeSv1ProcessEvent = "EeSv1.ProcessEvent"
|
||||
EeSv1ArchiveEventsInReply = "EeSv1.ArchiveEventsInReply"
|
||||
EeSv1ResetExporterMetrics = "EeSv1.ResetExporterMetrics"
|
||||
)
|
||||
|
||||
// ActionProfile APIs
|
||||
|
||||
Reference in New Issue
Block a user