@@ -22,6 +22,7 @@ import {
22
22
TaskRunSuccessfulExecutionResult ,
23
23
parsePacket ,
24
24
serverWebsocketMessages ,
25
+ SemanticInternalAttributes ,
25
26
} from "@trigger.dev/core/v3" ;
26
27
import { ZodMessageSender } from "@trigger.dev/core/v3/zodMessageHandler" ;
27
28
import {
@@ -1648,6 +1649,7 @@ export const AttemptForExecutionGetPayload = {
1648
1649
baseCostInCents : true ,
1649
1650
maxDurationInSeconds : true ,
1650
1651
tags : true ,
1652
+ taskEventStore : true ,
1651
1653
} ,
1652
1654
} ,
1653
1655
queue : {
@@ -1880,7 +1882,8 @@ class SharedQueueTasks {
1880
1882
const variables = await this . #buildEnvironmentVariables(
1881
1883
attempt . runtimeEnvironment ,
1882
1884
taskRun . id ,
1883
- machinePreset
1885
+ machinePreset ,
1886
+ taskRun . taskEventStore ?? undefined
1884
1887
) ;
1885
1888
1886
1889
const payload : V3ProdTaskRunExecutionPayload = {
@@ -2049,6 +2052,7 @@ class SharedQueueTasks {
2049
2052
} ,
2050
2053
} ,
2051
2054
machinePreset : true ,
2055
+ taskEventStore : true ,
2052
2056
} ,
2053
2057
} ) ;
2054
2058
@@ -2071,7 +2075,12 @@ class SharedQueueTasks {
2071
2075
const machinePreset =
2072
2076
machinePresetFromRun ( run ) ?? machinePresetFromConfig ( run . lockedBy ?. machineConfig ?? { } ) ;
2073
2077
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
+ ) ;
2075
2084
2076
2085
return {
2077
2086
traceContext : run . traceContext as Record < string , unknown > ,
@@ -2178,7 +2187,8 @@ class SharedQueueTasks {
2178
2187
async #buildEnvironmentVariables(
2179
2188
environment : RuntimeEnvironmentForEnvRepo ,
2180
2189
runId : string ,
2181
- machinePreset : MachinePreset
2190
+ machinePreset : MachinePreset ,
2191
+ taskEventStore ?: string
2182
2192
) : Promise < Array < EnvironmentVariable > > {
2183
2193
const variables = await resolveVariablesForEnvironment ( environment ) ;
2184
2194
@@ -2187,6 +2197,14 @@ class SharedQueueTasks {
2187
2197
machine_preset : machinePreset . name ,
2188
2198
} ) ;
2189
2199
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
+
2190
2208
return [
2191
2209
...variables ,
2192
2210
...[
0 commit comments