@@ -41,24 +41,8 @@ export class ExpressBridge {
4141 console . log ( 'Telemetry enabled: ' , ! ! process . env . EB_TELEMETRY ) ;
4242 if ( process . env . EB_TELEMETRY && this . options . telemetry ) {
4343 console . log ( 'Telemetry enabled, setting trace tag on event.' ) ;
44- if ( 'body' in incomingEvent ) {
45- incomingEvent . body =
46- typeof incomingEvent . body === 'string'
47- ? JSON . parse ( incomingEvent . body )
48- : incomingEvent . body ;
49- incomingEvent . body . eb_event_id =
50- incomingEvent . body ?. eb_event_id || v4 ( ) ;
51- } else if ( incomingEvent . Records ) {
52- for ( const record of incomingEvent . Records ) {
53- record . eb_event_id = record . eb_event_id || v4 ( ) ;
54- }
55- } else {
56- incomingEvent . eb_event_id = incomingEvent . eb_event_id || v4 ( ) ;
57- }
58- this . telemetry = new Telemetry (
59- incomingEvent . body . eb_event_id ,
60- this . options . telemetry
61- ) ;
44+ this . telemetry = new Telemetry ( this . options . telemetry ) ;
45+ const tag = this . telemetry . tagEvent ( incomingEvent ) ;
6246 }
6347
6448 await this . telemetry ?. beacon ( 'EB-PROCESS' , {
@@ -133,11 +117,7 @@ export class ExpressBridge {
133117 public post ( ...handlers : handlerType [ ] ) : void {
134118 this . postHandlers . push ( ...handlers ) ;
135119 }
136-
137- public getTelemetryId ( ) {
138- return this . telemetry . eb_event_id ;
139- }
140-
120+ /* */
141121 private match (
142122 incomingEvent : Record < string , any >
143123 ) : EventPattern < typeof incomingEvent > [ ] {
0 commit comments