| 1 | import type * as xray from "@distilled.cloud/aws/xray"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | export interface GetTraceGraphRequest extends xray.GetTraceGraphRequest {} |
| 6 | |
| 7 | /** |
| 8 | * Retrieve a service graph scoped to specific trace IDs — the services |
| 9 | * and edges the given traces traversed. |
| 10 | * |
| 11 | * Bind the operation in the function's init phase to get a runtime callable; |
| 12 | * provide the implementation with `Effect.provide(XRay.GetTraceGraphHttp)`. |
| 13 | * The action is account-scoped: X-Ray does not support resource-level |
| 14 | * permissions for `xray:GetTraceGraph`, so the binding grants it on `*`. |
| 15 | * ### Service Graphs & Statistics |
| 16 | * **Example:** Graph the services one trace touched |
| 17 | * ```typescript |
| 18 | * import * as XRay from "alchemy/AWS/XRay"; |
| 19 | * |
| 20 | * // init — grants xray:GetTraceGraph |
| 21 | * const getTraceGraph = yield* XRay.GetTraceGraph(); |
| 22 | * |
| 23 | * // runtime |
| 24 | * const graph = yield* getTraceGraph({ |
| 25 | * TraceIds: ["1-63a2090f-3f4da4bcd9b1a3e07531423b"], |
| 26 | * }); |
| 27 | * const services = graph.Services ?? []; |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface GetTraceGraph extends Binding.Service< |
| 33 | GetTraceGraph, |
| 34 | "AWS.XRay.GetTraceGraph", |
| 35 | () => Effect.Effect< |
| 36 | ( |
| 37 | request: GetTraceGraphRequest, |
| 38 | ) => Effect.Effect<xray.GetTraceGraphResult, xray.GetTraceGraphError> |
| 39 | > |
| 40 | > {} |
| 41 | export const GetTraceGraph = Binding.Service<GetTraceGraph>( |
| 42 | "AWS.XRay.GetTraceGraph", |
| 43 | ); |