1
- import {
2
- Context ,
3
- EventBridgeEvent ,
4
- KinesisStreamEvent ,
5
- SNSEvent ,
6
- SNSMessage ,
7
- SQSEvent
8
- } from "aws-lambda" ;
9
- import { BigNumber } from "bignumber.js" ;
10
- import { randomBytes } from "crypto" ;
11
- import { createSocket , Socket } from "dgram" ;
12
- import { logDebug , logError } from "../utils" ;
1
+ import { Context , EventBridgeEvent , KinesisStreamEvent , SNSEvent , SNSMessage , SQSEvent } from "aws-lambda" ;
2
+ import { BigNumber } from "bignumber.js" ;
3
+ import { randomBytes } from "crypto" ;
4
+ import { createSocket , Socket } from "dgram" ;
5
+ import { logDebug , logError } from "../utils" ;
13
6
import {
14
7
isAppSyncResolverEvent ,
15
8
isEventBridgeEvent ,
@@ -33,8 +26,8 @@ import {
33
26
xraySubsegmentNamespace ,
34
27
xrayTraceEnvVar ,
35
28
} from "./constants" ;
36
- import { TraceExtractor } from "./listener" ;
37
- import { eventSubTypes , parseEventSourceSubType } from "./trigger" ;
29
+ import { TraceExtractor } from "./listener" ;
30
+ import { eventSubTypes , parseEventSourceSubType } from "./trigger" ;
38
31
39
32
export interface XRayTraceHeader {
40
33
traceID : string ;
@@ -50,11 +43,11 @@ export interface TraceContext {
50
43
}
51
44
52
45
export interface StepFunctionContext {
53
- "step_function.execution_name" : string ,
54
- "step_function.execution_id" : string ,
55
- "step_function.execution_input" : object ,
56
- "step_function.execution_role_arn" : string ,
57
- "step_function.execution_start_time" : string ,
46
+ "step_function.execution_name" : string ;
47
+ "step_function.execution_id" : string ;
48
+ "step_function.execution_input" : object ;
49
+ "step_function.execution_role_arn" : string ;
50
+ "step_function.execution_start_time" : string ;
58
51
"step_function.state_machine_name" : string ;
59
52
"step_function.state_machine_arn" : string ;
60
53
"step_function.state_entered_time" : string ;
@@ -505,60 +498,60 @@ export function readStepFunctionContextFromEvent(event: any): StepFunctionContex
505
498
}
506
499
const executionID = execution . Id ;
507
500
if ( typeof executionID !== "string" ) {
508
- logDebug ( "event.Execution.Id is not a string." )
501
+ logDebug ( "event.Execution.Id is not a string." ) ;
509
502
return ;
510
503
}
511
504
const executionInput = execution . Input ;
512
505
const executionName = execution . Name ;
513
506
if ( typeof executionName !== "string" ) {
514
- logDebug ( "event.Execution.Name is not a string." )
507
+ logDebug ( "event.Execution.Name is not a string." ) ;
515
508
return ;
516
509
}
517
510
const executionRoleArn = execution . RoleArn ;
518
511
if ( typeof executionRoleArn !== "string" ) {
519
- logDebug ( "event.Execution.RoleArn is not a string." )
512
+ logDebug ( "event.Execution.RoleArn is not a string." ) ;
520
513
return ;
521
514
}
522
515
const executionStartTime = execution . StartTime ;
523
516
if ( typeof executionStartTime !== "string" ) {
524
- logDebug ( "event.Execution.StartTime is not a string." )
517
+ logDebug ( "event.Execution.StartTime is not a string." ) ;
525
518
return ;
526
519
}
527
520
528
521
const state = event . State ;
529
522
if ( typeof state !== "object" ) {
530
- logDebug ( "event.State is not an object." )
523
+ logDebug ( "event.State is not an object." ) ;
531
524
return ;
532
525
}
533
526
const stateRetryCount = state . RetryCount ;
534
527
if ( typeof stateRetryCount !== "number" ) {
535
- logDebug ( "event.State.RetryCount is not a string." )
528
+ logDebug ( "event.State.RetryCount is not a string." ) ;
536
529
return ;
537
530
}
538
531
const stateEnteredTime = state . EnteredTime ;
539
532
if ( typeof stateEnteredTime !== "string" ) {
540
- logDebug ( "event.State.EnteredTime is not a string." )
533
+ logDebug ( "event.State.EnteredTime is not a string." ) ;
541
534
return ;
542
535
}
543
536
const stateName = state . Name ;
544
537
if ( typeof stateName !== "string" ) {
545
- logDebug ( "event.State.Name is not a string." )
538
+ logDebug ( "event.State.Name is not a string." ) ;
546
539
return ;
547
540
}
548
541
549
542
const stateMachine = event . StateMachine ;
550
543
if ( typeof stateMachine !== "object" ) {
551
- logDebug ( "event.StateMachine is not an object." )
544
+ logDebug ( "event.StateMachine is not an object." ) ;
552
545
return ;
553
546
}
554
547
const stateMachineArn = stateMachine . Id ;
555
548
if ( typeof stateMachineArn !== "string" ) {
556
- logDebug ( "event.StateMachine.Id is not a string." )
549
+ logDebug ( "event.StateMachine.Id is not a string." ) ;
557
550
return ;
558
551
}
559
552
const stateMachineName = stateMachine . Name ;
560
553
if ( typeof stateMachineName !== "string" ) {
561
- logDebug ( "event.StateMachine.Name is not a string." )
554
+ logDebug ( "event.StateMachine.Name is not a string." ) ;
562
555
return ;
563
556
}
564
557
@@ -572,7 +565,7 @@ export function readStepFunctionContextFromEvent(event: any): StepFunctionContex
572
565
"step_function.state_machine_arn" : stateMachineArn ,
573
566
"step_function.state_machine_name" : stateMachineName ,
574
567
"step_function.state_name" : stateName ,
575
- "step_function.state_retry_count" : stateRetryCount
568
+ "step_function.state_retry_count" : stateRetryCount ,
576
569
} ;
577
570
}
578
571
0 commit comments