Datadog Guardrails Middleware
Budget: $250 – $750 USD
I need a small, self-contained middleware layer that focuses exclusively on Datadog & Guardrails inside my existing Bedrock-powered gateway. The rest of the framework (metadata injection, token accounting, etc.) is already in place—I now want tight observability plus enforcement.
Core scope
• Capture every Bedrock request/response and push latency metrics to Datadog under the namespace aws.bedrock.llm.usage.
• Attach rich, app-specific tags so the live dashboards can be filtered by application ID, environment, and any other identifier you feel is valuable for drill-downs.
• Implement guardrails that read the running cost totals (already calculated upstream) and, the moment a user or agent breaches its daily or monthly allowance, short-circuit the call with an HTTP 429 response.
Tech expectations
The current stack is Node.js running behind an AWS API Gateway. You are free to introduce TypeScript, OpenTelemetry SDK, or the Datadog AWS Lambda extension if that speeds things up. The final code must be clean, commented, and slot into an existing Express-style middleware chain with a single import.
Acceptance criteria
1. Latency for each Bedrock call appears in Datadog within 5 seconds, tagged with app-specific metadata.
2. A breached budget reliably triggers a 429 and writes a matching “blocked” event in Datadog.
3. Unit tests demonstrate both the happy path and the blocked path.
4. README shows environment variables, deployment steps, and a sample Datadog dashboard JSON.
If this sounds straightforward to you and you have recent Datadog instrumentation experience, let’s get started.
Core scope
• Capture every Bedrock request/response and push latency metrics to Datadog under the namespace aws.bedrock.llm.usage.
• Attach rich, app-specific tags so the live dashboards can be filtered by application ID, environment, and any other identifier you feel is valuable for drill-downs.
• Implement guardrails that read the running cost totals (already calculated upstream) and, the moment a user or agent breaches its daily or monthly allowance, short-circuit the call with an HTTP 429 response.
Tech expectations
The current stack is Node.js running behind an AWS API Gateway. You are free to introduce TypeScript, OpenTelemetry SDK, or the Datadog AWS Lambda extension if that speeds things up. The final code must be clean, commented, and slot into an existing Express-style middleware chain with a single import.
Acceptance criteria
1. Latency for each Bedrock call appears in Datadog within 5 seconds, tagged with app-specific metadata.
2. A breached budget reliably triggers a 429 and writes a matching “blocked” event in Datadog.
3. Unit tests demonstrate both the happy path and the blocked path.
4. README shows environment variables, deployment steps, and a sample Datadog dashboard JSON.
If this sounds straightforward to you and you have recent Datadog instrumentation experience, let’s get started.