All recipes
Datadog
CodeOTLPMetrics
Send metrics through a Datadog Agent configured to receive OTLP. Use the SDK's beforeSend hook with your existing OpenTelemetry metrics provider to record request duration.
SDK access required
Node.js and browser packages are not on public npm yet. Contact us for access before following the installation steps. Check the SDK reference for your runtime and review what the SDK sends.
Configure the OTLP exporter for Datadog
Enable the HTTP receiver and metrics in your Datadog Agent OTLP configuration. This example assumes the Agent is reachable at localhost:4318. Configure the Datadog API key on the Agent and start your application metrics provider before adding the hook.
Bash
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318Mirror CheckUpstream events into Datadog metrics
Use this with the initialized metrics provider from your application. See the OpenTelemetry recipe for sampling, retry and shutdown considerations.
instrumentation.ts
import { metrics } from "@opentelemetry/api";
import { initCheckUpstream } from "@checkupstream/sdk/integrations/next";
const meter = metrics.getMeter("checkupstream");
const latency = meter.createHistogram("upstream.latency_ms", { unit: "ms" });
export function register() {
const sdkKey = process.env.CHECKUPSTREAM_SDK_KEY;
if (!sdkKey) throw new Error("Set CHECKUPSTREAM_SDK_KEY before starting the app");
initCheckUpstream({
sdkKey,
beforeSend: (events) => {
for (const e of events) {
latency.record(e.latency_ms, {
service: e.service,
status: String(e.status),
});
}
return events;
},
});
}Continue your setup
Check runtime availability and credentials before deploying an integration.