Skip to content

StartTraceRetrieval

Source: src/AWS/XRay/StartTraceRetrieval.ts

Initiate a Transaction Search trace retrieval for the given trace IDs and time range, returning a RetrievalToken for ListRetrievedTraces and GetRetrievedTracesGraph.

Bind the operation in the function’s init phase to get a runtime callable; provide the implementation with Effect.provide(XRay.StartTraceRetrievalHttp). The action is account-scoped: X-Ray does not support resource-level permissions for xray:StartTraceRetrieval, so the binding grants it on *.

import * as XRay from "alchemy/AWS/XRay";
// init — grants xray:StartTraceRetrieval
const startTraceRetrieval = yield* XRay.StartTraceRetrieval();
// runtime
const now = yield* Effect.sync(() => Date.now());
const retrieval = yield* startTraceRetrieval({
TraceIds: ["1-63a2090f-3f4da4bcd9b1a3e07531423b"],
StartTime: new Date(now - 60 * 60 * 1000),
EndTime: new Date(now),
});
const token = retrieval.RetrievalToken;