@@ -45,6 +45,7 @@ import (
4545 common_event "github.com/AliceO2Group/Control/common/event"
4646 "github.com/AliceO2Group/Control/common/event/topic"
4747 "github.com/AliceO2Group/Control/common/logger/infologger"
48+ "github.com/AliceO2Group/Control/common/monitoring"
4849 pb "github.com/AliceO2Group/Control/common/protos"
4950 "github.com/AliceO2Group/Control/common/utils"
5051 "github.com/AliceO2Group/Control/common/utils/uid"
@@ -184,6 +185,7 @@ func (p *Plugin) GetConnectionState() string {
184185func (p * Plugin ) queryPartitionStatus () {
185186 defer utils .TimeTrackFunction (time .Now (), log .WithPrefix ("odcclient" ))
186187 ctx , cancel := context .WithTimeout (context .Background (), ODC_STATUS_TIMEOUT )
188+ monitoring .AddEnvAndRunType (ctx , "none" , "none" )
187189 defer cancel ()
188190
189191 statusRep := & odc.StatusReply {}
@@ -239,6 +241,7 @@ func (p *Plugin) queryPartitionStatus() {
239241 defer wg .Done ()
240242
241243 ctx , cancel := context .WithTimeout (context .Background (), ODC_STATUS_TIMEOUT )
244+ monitoring .AddEnvAndRunType (ctx , "none" , "none" )
242245 defer cancel ()
243246
244247 odcPartStateRep , err := p .odcClient .GetState (ctx , & odc.StateRequest {
@@ -1179,7 +1182,7 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
11791182
11801183 timeout := callable .AcquireTimeout (ODC_PARTITIONINITIALIZE_TIMEOUT , varStack , "PartitionInitialize" , envId )
11811184
1182- ctx , cancel := context . WithTimeout ( context . Background () , timeout )
1185+ ctx , cancel := integration . NewContext ( envId , varStack , timeout )
11831186 defer cancel ()
11841187
11851188 err = handleRun (ctx , p .odcClient , isManualXml , map [string ]string {
@@ -1292,7 +1295,7 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
12921295 }
12931296 }
12941297
1295- ctx , cancel := context . WithTimeout ( context . Background () , timeout )
1298+ ctx , cancel := integration . NewContext ( envId , varStack , timeout )
12961299 defer cancel ()
12971300 err := handleConfigure (ctx , p .odcClient , arguments , paddingTimeout , envId , call )
12981301 if err != nil {
@@ -1314,7 +1317,7 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
13141317
13151318 callFailedStr := "EPN Reset call failed"
13161319
1317- ctx , cancel := context . WithTimeout ( context . Background () , timeout )
1320+ ctx , cancel := integration . NewContext ( envId , call . VarStack , timeout )
13181321 defer cancel ()
13191322 err := handleReset (ctx , p .odcClient , nil , paddingTimeout , envId , call )
13201323 if err != nil {
@@ -1343,7 +1346,7 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
13431346
13441347 callFailedStr := "EPN PartitionTerminate call failed"
13451348
1346- ctx , cancel := context . WithTimeout ( context . Background () , timeout )
1349+ ctx , cancel := integration . NewContext ( envId , varStack , timeout )
13471350 defer cancel ()
13481351 err := handlePartitionTerminate (ctx , p .odcClient , nil , paddingTimeout , envId , call )
13491352 if err != nil {
@@ -1414,7 +1417,7 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
14141417 arguments ["original_run_number" ] = originalRunNumber
14151418 }
14161419
1417- ctx , cancel := context . WithTimeout ( context . Background () , timeout )
1420+ ctx , cancel := integration . NewContext ( envId , varStack , timeout )
14181421 defer cancel ()
14191422 err = handleStart (ctx , p .odcClient , arguments , paddingTimeout , envId , runNumberu64 , call )
14201423 if err != nil {
@@ -1462,7 +1465,7 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
14621465
14631466 timeout := callable .AcquireTimeout (ODC_STOP_TIMEOUT , varStack , "Stop" , envId )
14641467
1465- ctx , cancel := context . WithTimeout ( context . Background () , timeout )
1468+ ctx , cancel := integration . NewContext ( envId , varStack , timeout )
14661469 defer cancel ()
14671470 err = handleStop (ctx , p .odcClient , arguments , paddingTimeout , envId , runNumberu64 , call )
14681471 if err != nil {
@@ -1486,7 +1489,7 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
14861489
14871490 timeout := callable .AcquireTimeout (ODC_STOP_TIMEOUT , varStack , "EnsureStop" , envId )
14881491
1489- ctx , cancel := context . WithTimeout ( context . Background () , timeout )
1492+ ctx , cancel := integration . NewContext ( envId , varStack , timeout )
14901493 defer cancel ()
14911494
14921495 state , err := handleGetState (ctx , p .odcClient , envId )
@@ -1551,7 +1554,7 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
15511554
15521555 callFailedStr := "EPN EnsureCleanup call failed"
15531556
1554- ctx , cancel := context . WithTimeout ( context . Background () , timeout )
1557+ ctx , cancel := integration . NewContext ( envId , varStack , timeout )
15551558 defer cancel ()
15561559 err := handleCleanup (ctx , p .odcClient , nil , paddingTimeout , envId , call )
15571560 if err != nil {
@@ -1572,7 +1575,7 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
15721575
15731576 callFailedStr := "EPN PreDeploymentCleanup call failed"
15741577
1575- ctx , cancel := context . WithTimeout ( context . Background () , timeout )
1578+ ctx , cancel := integration . NewContext ( envId , varStack , timeout )
15761579 defer cancel ()
15771580 err := handleCleanup (ctx , p .odcClient , nil , paddingTimeout , "" , call )
15781581 if err != nil {
@@ -1593,7 +1596,7 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
15931596
15941597 callFailedStr := "EPN EnsureCleanupLegacy call failed"
15951598
1596- ctx , cancel := context . WithTimeout ( context . Background () , timeout )
1599+ ctx , cancel := integration . NewContext ( envId , varStack , timeout )
15971600 defer cancel ()
15981601 err := handleCleanupLegacy (ctx , p .odcClient , nil , paddingTimeout , envId , call )
15991602 if err != nil {
0 commit comments