@@ -1004,6 +1004,7 @@ export class EventRepository {
10041004 const span = await this . #createSpanFromEvent(
10051005 storeTable ,
10061006 preparedEvent ,
1007+ environmentId ,
10071008 startCreatedAt ,
10081009 endCreatedAt
10091010 ) ;
@@ -1089,6 +1090,7 @@ export class EventRepository {
10891090 async #createSpanFromEvent(
10901091 storeTable : TaskEventStoreTable ,
10911092 event : PreparedEvent ,
1093+ environmentId : string ,
10921094 startCreatedAt : Date ,
10931095 endCreatedAt ?: Date
10941096 ) {
@@ -1099,6 +1101,7 @@ export class EventRepository {
10991101 await this . #walkSpanAncestors(
11001102 storeTable ,
11011103 event ,
1104+ environmentId ,
11021105 startCreatedAt ,
11031106 endCreatedAt ,
11041107 ( ancestorEvent , level ) => {
@@ -1193,6 +1196,7 @@ export class EventRepository {
11931196 async #walkSpanAncestors(
11941197 storeTable : TaskEventStoreTable ,
11951198 event : PreparedEvent ,
1199+ environmentId : string ,
11961200 startCreatedAt : Date ,
11971201 endCreatedAt : Date | undefined ,
11981202 callback : ( event : PreparedEvent , level : number ) => { stop : boolean }
@@ -1206,6 +1210,7 @@ export class EventRepository {
12061210 let parentEvent = await this . #getSpanEvent( {
12071211 storeTable,
12081212 spanId : parentId ,
1213+ environmentId,
12091214 startCreatedAt,
12101215 endCreatedAt,
12111216 } ) ;
@@ -1227,6 +1232,7 @@ export class EventRepository {
12271232 parentEvent = await this . #getSpanEvent( {
12281233 storeTable,
12291234 spanId : preparedParentEvent . parentId ,
1235+ environmentId,
12301236 startCreatedAt,
12311237 endCreatedAt,
12321238 } ) ;
@@ -1246,15 +1252,15 @@ export class EventRepository {
12461252 } : {
12471253 storeTable : TaskEventStoreTable ;
12481254 spanId : string ;
1249- environmentId ? : string ;
1255+ environmentId : string ;
12501256 startCreatedAt : Date ;
12511257 endCreatedAt ?: Date ;
12521258 options ?: { includeDebugLogs ?: boolean } ;
12531259 } ) {
12541260 return await startActiveSpan ( "getSpanEvent" , async ( s ) => {
12551261 const events = await this . taskEventStore . findMany (
12561262 storeTable ,
1257- { spanId, ... ( environmentId ? { environmentId } : { } ) } ,
1263+ { spanId, environmentId } ,
12581264 startCreatedAt ,
12591265 endCreatedAt ,
12601266 undefined ,
0 commit comments