Skip to content
telemioDeveloper Docs
Open console
DOCUMENTATIONQuickstart · OpenTelemetryBrowse integrations ↗
Docs/Implementation guides/Backend services/Node.js and TypeScript SDK
IMPLEMENTATION GUIDE

Node.js and TypeScript SDK

Add spans, logs, metrics and feature flags to a Node.js checkout service.

What you will build

Add spans, logs, metrics and feature flags to a Node.js checkout service.

← All implementation paths

Install and configure

The JavaScript SDK adds explicit business telemetry to a trusted Node.js process. Automatic HTTP/database instrumentation can continue to use regular OpenTelemetry.

Before you begin: Create a Telemio workspace and a scoped ingest credential in the console. Keep server keys in deployment secrets. Set service.name and an environment on every service, and verify signals in the console after starting the process.
Shell
npm install @telemio/sdk
export TELEMIO_API_KEY="your-server-ingest-key"

telemetry.ts

TypeScript
import { createTelemio } from "@telemio/sdk"

export const telemio = createTelemio({
  apiKey: process.env.TELEMIO_API_KEY,
  serviceName: "checkout-api",
  environment: process.env.NODE_ENV || "development",
  release: process.env.APP_VERSION || "local"
})

Instrument a real request

Wrap a meaningful operation, record failures, and export an outcome metric. Await SDK calls where you need delivery guarantees.

checkout.ts

TypeScript
import { telemio } from "./telemetry"

export async function completeOrder(orderId: string, charge: () => Promise<void>) {
  return telemio.tracer.withSpan("checkout.complete", async (span) => {
    span.setAttribute("order.id", orderId)
    await charge()
    await telemio.metrics.count("checkout.completed", 1, { channel: "web" })
    await telemio.logger.info("Order completed", { "order.id": orderId })
    return { orderId, status: "completed" }
  }, { "checkout.channel": "web" })
}

Never record card numbers, API tokens, passwords, or raw customer payloads in attributes. Use stable identifiers only when your privacy policy permits them.

Feature flags and rollout

Evaluate on your server with a stable targeting key. A safe default is returned when evaluation cannot be performed.

TypeScript
const decision = await telemio.flags.boolean(
  "new-checkout", false, { targetingKey: accountId }
)

if (decision.value) {
  await runNewCheckout()
} else {
  await runClassicCheckout()
}

Use a workspace or feature credential configured for flag evaluation; an ingest-only key does not grant additional permissions.

Verify the integration

Create a test order and inspect the service and environment in Telemio. Confirm a checkout span, a log and a metric.

If nothing appears, verify TELEMIO_API_KEY, network egress to https://api.telemio.sh, the configured service name, and your credentials. See the SDK reference.