Skip to content

GetSamplingRules

Source: src/AWS/XRay/GetSamplingRules.ts

Retrieve all X-Ray sampling rules — the first half of the sampling protocol used by custom samplers (poll rules, then report statistics via GetSamplingTargets).

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

import * as XRay from "alchemy/AWS/XRay";
// init — grants xray:GetSamplingRules
const getSamplingRules = yield* XRay.GetSamplingRules();
// runtime
const rules = yield* getSamplingRules();
const names = (rules.SamplingRuleRecords ?? []).map(
(record) => record.SamplingRule?.RuleName,
);