@@ -29,6 +29,7 @@ import { Logger, ConsoleLogger } from "../types/logger.type";
2929import { StartOrchestrationOptions } from "../task/options" ;
3030import { mapToRecord } from "../utils/tags.util" ;
3131import { populateTagsMap } from "../utils/pb-helper.util" ;
32+ import * as ClientLogs from "./logs" ;
3233import {
3334 startSpanForNewOrchestration ,
3435 startSpanForEventRaisedFromClient ,
@@ -228,7 +229,9 @@ export class TaskHubGrpcClient {
228229 // Create a tracing span for the new orchestration (if OTEL is available)
229230 const span = startSpanForNewOrchestration ( req ) ;
230231
231- this . _logger . info ( `Starting new ${ name } instance with ID = ${ req . getInstanceid ( ) } ${ effectiveVersion ? ` (version: ${ effectiveVersion } )` : "" } ` ) ;
232+ const serializedInput = i . getValue ( ) ?? "" ;
233+ const inputSizeInBytes = Buffer . byteLength ( serializedInput , "utf8" ) ;
234+ ClientLogs . schedulingOrchestration ( this . _logger , req . getInstanceid ( ) , name , inputSizeInBytes ) ;
232235
233236 try {
234237 const res = await callWithMetadata < pb . CreateInstanceRequest , pb . CreateInstanceResponse > (
@@ -340,7 +343,7 @@ export class TaskHubGrpcClient {
340343 req . setInstanceid ( instanceId ) ;
341344 req . setGetinputsandoutputs ( fetchPayloads ) ;
342345
343- this . _logger . info ( `Waiting ${ timeout } seconds for instance ${ instanceId } to complete...` ) ;
346+ ClientLogs . waitingForInstanceCompletion ( this . _logger , instanceId ) ;
344347
345348 const callPromise = callWithMetadata < pb . GetInstanceRequest , pb . GetInstanceResponse > (
346349 this . _stub . waitForInstanceCompletion . bind ( this . _stub ) ,
@@ -364,11 +367,11 @@ export class TaskHubGrpcClient {
364367
365368 if ( state . runtimeStatus === OrchestrationStatus . FAILED && state . failureDetails ) {
366369 details = state . failureDetails ;
367- this . _logger . info ( `Instance ${ instanceId } failed: [ ${ details . errorType } ] ${ details . message } ` ) ;
370+ ClientLogs . instanceFailed ( this . _logger , instanceId , details . errorType , details . message ) ;
368371 } else if ( state . runtimeStatus === OrchestrationStatus . TERMINATED ) {
369- this . _logger . info ( `Instance ${ instanceId } was terminated` ) ;
372+ ClientLogs . instanceTerminated ( this . _logger , instanceId ) ;
370373 } else if ( state . runtimeStatus === OrchestrationStatus . COMPLETED ) {
371- this . _logger . info ( `Instance ${ instanceId } completed` ) ;
374+ ClientLogs . instanceCompleted ( this . _logger , instanceId ) ;
372375 }
373376
374377 return state ;
@@ -397,7 +400,7 @@ export class TaskHubGrpcClient {
397400 // Create a tracing span for the raised event (if OTEL is available)
398401 const span = startSpanForEventRaisedFromClient ( eventName , instanceId ) ;
399402
400- this . _logger . info ( `Raising event ' ${ eventName } ' for instance ' ${ instanceId } '` ) ;
403+ ClientLogs . raisingEvent ( this . _logger , instanceId , eventName ) ;
401404
402405 try {
403406 await callWithMetadata < pb . RaiseEventRequest , pb . RaiseEventResponse > (
@@ -461,7 +464,7 @@ export class TaskHubGrpcClient {
461464 req . setOutput ( i ) ;
462465 req . setRecursive ( recursive ) ;
463466
464- this . _logger . info ( `Terminating ' ${ instanceId } ' ${ recursive ? ' (recursive)' : '' } ` ) ;
467+ ClientLogs . terminatingInstance ( this . _logger , instanceId ) ;
465468
466469 await callWithMetadata < pb . TerminateRequest , pb . TerminateResponse > (
467470 this . _stub . terminateInstance . bind ( this . _stub ) ,
@@ -474,7 +477,7 @@ export class TaskHubGrpcClient {
474477 const req = new pb . SuspendRequest ( ) ;
475478 req . setInstanceid ( instanceId ) ;
476479
477- this . _logger . info ( `Suspending ' ${ instanceId } '` ) ;
480+ ClientLogs . suspendingInstance ( this . _logger , instanceId ) ;
478481
479482 await callWithMetadata < pb . SuspendRequest , pb . SuspendResponse > (
480483 this . _stub . suspendInstance . bind ( this . _stub ) ,
@@ -487,7 +490,7 @@ export class TaskHubGrpcClient {
487490 const req = new pb . ResumeRequest ( ) ;
488491 req . setInstanceid ( instanceId ) ;
489492
490- this . _logger . info ( `Resuming ' ${ instanceId } '` ) ;
493+ ClientLogs . resumingInstance ( this . _logger , instanceId ) ;
491494
492495 await callWithMetadata < pb . ResumeRequest , pb . ResumeResponse > (
493496 this . _stub . resumeInstance . bind ( this . _stub ) ,
@@ -525,7 +528,7 @@ export class TaskHubGrpcClient {
525528 req . setReason ( reasonValue ) ;
526529 }
527530
528- this . _logger . info ( `Rewinding ' ${ instanceId } ' with reason: ${ reason } ` ) ;
531+ ClientLogs . rewindingInstance ( this . _logger , instanceId , reason ) ;
529532
530533 try {
531534 await callWithMetadata < pb . RewindInstanceRequest , pb . RewindInstanceResponse > (
@@ -582,7 +585,7 @@ export class TaskHubGrpcClient {
582585 req . setInstanceid ( instanceId ) ;
583586 req . setRestartwithnewinstanceid ( restartWithNewInstanceId ) ;
584587
585- this . _logger . info ( `Restarting ' ${ instanceId } ' with restartWithNewInstanceId= ${ restartWithNewInstanceId } ` ) ;
588+ ClientLogs . restartingInstance ( this . _logger , instanceId , restartWithNewInstanceId ) ;
586589
587590 try {
588591 const res = await callWithMetadata < pb . RestartInstanceRequest , pb . RestartInstanceResponse > (
@@ -637,7 +640,7 @@ export class TaskHubGrpcClient {
637640 req . setInstanceid ( instanceId ) ;
638641 req . setRecursive ( options ?. recursive ?? false ) ;
639642
640- this . _logger . info ( `Purging Instance ' ${ instanceId } ' ${ options ?. recursive ? ' (recursive)' : '' } ` ) ;
643+ ClientLogs . purgingInstanceMetadata ( this . _logger , instanceId ) ;
641644
642645 res = await callWithMetadata < pb . PurgeInstancesRequest , pb . PurgeInstancesResponse > (
643646 this . _stub . purgeInstances . bind ( this . _stub ) ,
@@ -668,7 +671,7 @@ export class TaskHubGrpcClient {
668671 req . setRecursive ( options ?. recursive ?? false ) ;
669672 const timeout = purgeInstanceCriteria . getTimeout ( ) ;
670673
671- this . _logger . info ( `Purging Instances using purging criteria ${ options ?. recursive ? " (recursive)" : "" } ` ) ;
674+ ClientLogs . purgingInstances ( this . _logger , createdTimeFrom , createdTimeTo , runtimeStatusList . map ( String ) . join ( ", " ) ) ;
672675
673676 const callPromise = callWithMetadata < pb . PurgeInstancesRequest , pb . PurgeInstancesResponse > (
674677 this . _stub . purgeInstances . bind ( this . _stub ) ,
0 commit comments