Updated dispatcher API methods

This commit is contained in:
Tripon Alexandru-Ionut
2019-04-17 14:40:18 +03:00
committed by Dan Christian Bogos
parent bbc34b1f77
commit 7093dd70d1
34 changed files with 348 additions and 113 deletions

View File

@@ -479,7 +479,7 @@ func (fltr *FilterRule) passStatS(dP config.DataProvider,
for _, statItem := range fltr.statItems {
statValues := make(map[string]float64)
if err := stats.Call(utils.StatSv1GetQueueFloatMetrics,
&utils.TenantID{Tenant: tenant, ID: statItem.ItemID}, &statValues); err != nil {
&utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: tenant, ID: statItem.ItemID}}, &statValues); err != nil {
return false, err
}
//convert statValues to map[string]interface{}

View File

@@ -241,12 +241,12 @@ func (rs *Responder) GetMaxSessionTime(arg *CallDescriptorWithArgDispatcher, rep
return
}
func (rs *Responder) Status(arg string, reply *map[string]interface{}) (err error) {
if arg != "" { // Introduce delay in answer, used in some automated tests
if delay, err := utils.ParseDurationWithNanosecs(arg); err == nil {
time.Sleep(delay)
}
}
func (rs *Responder) Status(arg *utils.TenantWithArgDispatcher, reply *map[string]interface{}) (err error) {
// if arg != "" { // Introduce delay in answer, used in some automated tests
// if delay, err := utils.ParseDurationWithNanosecs(arg); err == nil {
// time.Sleep(delay)
// }
// }
memstats := new(runtime.MemStats)
runtime.ReadMemStats(memstats)
response := make(map[string]interface{})
@@ -261,7 +261,7 @@ func (rs *Responder) Status(arg string, reply *map[string]interface{}) (err erro
return
}
func (rs *Responder) Shutdown(arg string, reply *string) (err error) {
func (rs *Responder) Shutdown(arg *utils.TenantWithArgDispatcher, reply *string) (err error) {
dm.DataDB().Close()
cdrStorage.Close()
defer func() { rs.ExitChan <- true }()
@@ -270,7 +270,7 @@ func (rs *Responder) Shutdown(arg string, reply *string) (err error) {
}
// Ping used to detreminate if component is active
func (chSv1 *Responder) Ping(ign *utils.CGREvent, reply *string) error {
func (chSv1 *Responder) Ping(ign *utils.CGREventWithArgDispatcher, reply *string) error {
*reply = utils.Pong
return nil
}

View File

@@ -260,7 +260,7 @@ func (spS *SupplierService) statMetrics(statIDs []string, tenant string) (stsMet
for _, statID := range statIDs {
var metrics map[string]float64
if err = spS.statS.Call(utils.StatSv1GetQueueFloatMetrics,
&utils.TenantID{Tenant: tenant, ID: statID}, &metrics); err != nil &&
&utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: tenant, ID: statID}}, &metrics); err != nil &&
err.Error() != utils.ErrNotFound.Error() {
utils.Logger.Warning(
fmt.Sprintf("<SupplierS> error: %s getting statMetrics for stat : %s", err.Error(), statID))