@@ -22,6 +22,7 @@ import {
2222 TaskRunSuccessfulExecutionResult ,
2323 parsePacket ,
2424 serverWebsocketMessages ,
25+ SemanticInternalAttributes ,
2526} from "@trigger.dev/core/v3" ;
2627import { ZodMessageSender } from "@trigger.dev/core/v3/zodMessageHandler" ;
2728import {
@@ -1648,6 +1649,7 @@ export const AttemptForExecutionGetPayload = {
16481649 baseCostInCents : true ,
16491650 maxDurationInSeconds : true ,
16501651 tags : true ,
1652+ taskEventStore : true ,
16511653 } ,
16521654 } ,
16531655 queue : {
@@ -1880,7 +1882,8 @@ class SharedQueueTasks {
18801882 const variables = await this . #buildEnvironmentVariables(
18811883 attempt . runtimeEnvironment ,
18821884 taskRun . id ,
1883- machinePreset
1885+ machinePreset ,
1886+ taskRun . taskEventStore ?? undefined
18841887 ) ;
18851888
18861889 const payload : V3ProdTaskRunExecutionPayload = {
@@ -2049,6 +2052,7 @@ class SharedQueueTasks {
20492052 } ,
20502053 } ,
20512054 machinePreset : true ,
2055+ taskEventStore : true ,
20522056 } ,
20532057 } ) ;
20542058
@@ -2071,7 +2075,12 @@ class SharedQueueTasks {
20712075 const machinePreset =
20722076 machinePresetFromRun ( run ) ?? machinePresetFromConfig ( run . lockedBy ?. machineConfig ?? { } ) ;
20732077
2074- const variables = await this . #buildEnvironmentVariables( environment , run . id , machinePreset ) ;
2078+ const variables = await this . #buildEnvironmentVariables(
2079+ environment ,
2080+ run . id ,
2081+ machinePreset ,
2082+ run . taskEventStore ?? undefined
2083+ ) ;
20752084
20762085 return {
20772086 traceContext : run . traceContext as Record < string , unknown > ,
@@ -2178,7 +2187,8 @@ class SharedQueueTasks {
21782187 async #buildEnvironmentVariables(
21792188 environment : RuntimeEnvironmentForEnvRepo ,
21802189 runId : string ,
2181- machinePreset : MachinePreset
2190+ machinePreset : MachinePreset ,
2191+ taskEventStore ?: string
21822192 ) : Promise < Array < EnvironmentVariable > > {
21832193 const variables = await resolveVariablesForEnvironment ( environment ) ;
21842194
@@ -2187,6 +2197,14 @@ class SharedQueueTasks {
21872197 machine_preset : machinePreset . name ,
21882198 } ) ;
21892199
2200+ if ( taskEventStore ) {
2201+ const resourceAttributes = JSON . stringify ( {
2202+ [ SemanticInternalAttributes . TASK_EVENT_STORE ] : taskEventStore ,
2203+ } ) ;
2204+
2205+ variables . push ( ...[ { key : "OTEL_RESOURCE_ATTRIBUTES" , value : resourceAttributes } ] ) ;
2206+ }
2207+
21902208 return [
21912209 ...variables ,
21922210 ...[
0 commit comments