@jaypie/datadog
Datadog metrics and observability integration.
Overview
Section titled “Overview”@jaypie/datadog provides integration with Datadog for metrics and observability in Jaypie applications.
Installation
Section titled “Installation”npm install @jaypie/datadogKey Features
Section titled “Key Features”Metrics Submission
Section titled “Metrics Submission”Submit custom metrics to Datadog:
import { submitMetric } from "@jaypie/datadog";
await submitMetric("custom.metric", 42, { tags: ["env:production"] });Observability
Section titled “Observability”Built-in observability for Jaypie handlers and AWS Lambda functions.
APM Spans
Section titled “APM Spans”Tag and measure the active APM (dd-trace) span from inside handler code:
import { tagSpan, traceSpan } from "@jaypie/datadog";
tagSpan("order.id", orderId); // tag the active spantagSpan({ "order.id": orderId, "order.tier": tier }); // object form
await traceSpan("ocr", async () => { tagSpan("pages", 12); // attaches to THIS child span, scoped to the region return runOcr();}); // span auto-finishes here = the duration measuredtagSpan sets tag(s) on the active span; the caller chooses the key namespace
(avoid Datadog’s reserved test.* / ci.*). traceSpan runs a region as a
child span kept active across awaits and returns the callback’s result. Both
resolve the runtime dd-trace singleton in a bundler-safe way and silently
no-op (never throw) when there is no active span — e.g. running locally or in
tests.
API Documentation
Section titled “API Documentation”API documentation will be generated from TypeScript definitions.
Related Packages
Section titled “Related Packages”- @jaypie/core - Core utilities
- @jaypie/lambda - AWS Lambda integration