@@ -28,7 +28,9 @@ import (
2828 "context"
2929 "errors"
3030 "fmt"
31+ "time"
3132
33+ "github.com/AliceO2Group/Control/common/utils"
3234 "github.com/AliceO2Group/Control/core/integration/odc/odcutils"
3335 odcpb "github.com/AliceO2Group/Control/core/integration/odc/protos"
3436 "github.com/k0kubun/pp"
@@ -38,6 +40,7 @@ import (
3840)
3941
4042func handleGetState (ctx context.Context , odcClient * RpcClient , envId string ) (string , error ) {
43+ defer utils .TimeTrackFunction (time .Now (), log .WithPrefix ("odcclient" ))
4144 req := & odcpb.StateRequest {
4245 Partitionid : envId ,
4346 Path : "" ,
@@ -85,6 +88,7 @@ func handleGetState(ctx context.Context, odcClient *RpcClient, envId string) (st
8588}
8689
8790func handleStart (ctx context.Context , odcClient * RpcClient , arguments map [string ]string , envId string ) error {
91+ defer utils .TimeTrackFunction (time .Now (), log .WithPrefix ("odcclient" ))
8892 req := & odcpb.StartRequest {
8993 Request : & odcpb.StateRequest {
9094 Partitionid : envId ,
@@ -173,6 +177,7 @@ func handleStart(ctx context.Context, odcClient *RpcClient, arguments map[string
173177}
174178
175179func handleStop (ctx context.Context , odcClient * RpcClient , arguments map [string ]string , envId string ) error {
180+ defer utils .TimeTrackFunction (time .Now (), log .WithPrefix ("odcclient" ))
176181 req := & odcpb.StopRequest {
177182 Request : & odcpb.StateRequest {
178183 Partitionid : envId ,
@@ -216,6 +221,7 @@ func handleStop(ctx context.Context, odcClient *RpcClient, arguments map[string]
216221}
217222
218223func handleReset (ctx context.Context , odcClient * RpcClient , arguments map [string ]string , envId string ) error {
224+ defer utils .TimeTrackFunction (time .Now (), log .WithPrefix ("odcclient" ))
219225 if envId == "" {
220226 return errors .New ("cannot proceed with empty environment id" )
221227 }
@@ -238,6 +244,7 @@ func handleReset(ctx context.Context, odcClient *RpcClient, arguments map[string
238244}
239245
240246func handleCleanup (ctx context.Context , odcClient * RpcClient , arguments map [string ]string , envId string ) error {
247+ defer utils .TimeTrackFunction (time .Now (), log .WithPrefix ("odcclient" ))
241248 if envId == "" {
242249 return errors .New ("cannot proceed with empty environment id" )
243250 }
@@ -384,6 +391,7 @@ func handleExit(ctx context.Context, odcClient *RpcClient, arguments map[string]
384391}
385392
386393func handleRun (ctx context.Context , odcClient * RpcClient , arguments map [string ]string , envId string ) error {
394+ defer utils .TimeTrackFunction (time .Now (), log .WithPrefix ("odcclient" ))
387395 if envId == "" {
388396 return errors .New ("cannot proceed with empty environment id" )
389397 }
@@ -447,6 +455,7 @@ func handleRun(ctx context.Context, odcClient *RpcClient, arguments map[string]s
447455
448456
449457func handleConfigure (ctx context.Context , odcClient * RpcClient , arguments map [string ]string , topology string , plugin string , resources string , envId string ) error {
458+ defer utils .TimeTrackFunction (time .Now (), log .WithPrefix ("odcclient" ))
450459 if envId == "" {
451460 return errors .New ("cannot proceed with empty environment id" )
452461 }
0 commit comments