Interface DurableExecutionPlugin
Implement this interface to integrate observability tools (OpenTelemetry, Datadog, etc.) with the durable execution SDK. The SDK calls these hooks at key lifecycle points without requiring modifications to core SDK code.
All methods have default no-op implementations, allowing plugins to override only the hooks they need.
Plugin errors are isolated — exceptions thrown by plugin methods are caught and logged but never disrupt SDK execution.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidDeprecated.Called at the end of each Lambda invocation.default voidDeprecated.Called at the start of each Lambda invocation.default voidDeprecated.Called when an operation reaches a terminal status for the first time (not on replay).default voidDeprecated.Called when an operation starts (including replay).default voidDeprecated.Called when a user-provided function finishes executing.default voidDeprecated.Called when a user-provided function starts executing.
-
Method Details
-
onInvocationStart
Deprecated.Called at the start of each Lambda invocation. Use to set up per-invocation state (trace ID, invocation span).Check
InvocationInfo.isFirstInvocation()to detect the first invocation of an execution (useful for sampling decisions or execution-level span creation). -
onInvocationEnd
Deprecated.Called at the end of each Lambda invocation. Use to flush spans/metrics before Lambda freezes.This hook is awaited — the SDK blocks until it returns. This is the only safe flush point before Lambda freezes the execution environment.
Check
InvocationEndInfo.invocationStatus()to detect if the execution reached a terminal state in this invocation (useful for writing summary records or flushing final data). -
onOperationStart
Deprecated.Called when an operation starts (including replay). Use for logging/metrics that want replay visibility. -
onOperationEnd
Deprecated.Called when an operation reaches a terminal status for the first time (not on replay).The OTel plugin creates operation spans here with backfilled start/end timestamps.
-
onUserFunctionStart
Deprecated.Called when a user-provided function starts executing. This fires for both step attempts (withattemptset) and child context functions (withattemptnull).This hook fires on the same thread as user code, so plugins can set OTel context via
Context.makeCurrent()here. -
onUserFunctionEnd
Deprecated.Called when a user-provided function finishes executing. This fires for both step attempts and child context functions.This hook fires on the same thread as user code, so plugins can close OTel scopes here.
-