# Cloud trace-check API This small Node.js API creates an OpenTelemetry SERVER span for `GET /api/trace-check`, extracts incoming W3C context, and returns its active trace ID. It exports OTLP/HTTP protobuf and flushes the SDK during graceful shutdown. `/healthz` returns a simple untraced health response. Use it to verify a cloud deployment before instrumenting an application. It contains no business endpoints or authentication; put it in staging or behind your existing access controls. It does not automatically instrument arbitrary dependencies or add downstream CLIENT spans. ## Build Copy [package.json](package.json), [server.cjs](server.cjs), and [Dockerfile](Dockerfile) into a working directory. Install dependencies with a supported Node.js runtime, retain the generated lockfile, and build for the target platform: ```bash npm install export IMAGE=YOUR_REGISTRY/shop-api:YOUR_RELEASE docker build --platform linux/amd64 -t "$IMAGE" . docker push "$IMAGE" ``` The shown architecture targets an x86-64 deployment. Match it to your actual platform if using ARM64. Authenticate to the image registry before pushing. Pin your production base image by digest after validating it. ## Configure Set `PORT=8080` and use the [shared cloud exporter settings](../../README.md#shared-export-settings). Set `APP_ORIGIN=https://www.example.com` when the frontend is cross-origin; the sample allows that exact origin to make GET requests with `traceparent`. It does not enable credentialed CORS cookies. Provide the full `OTEL_EXPORTER_OTLP_HEADERS=X-CORRIDORA-KEY=...` assignment through the platform's secret injection. To test against a local Collector instead, set the base endpoint to its reachable HTTP listener and remove direct-export key overrides. ## Verify After [RUM](../../../../browser-rum.md) initializes, fetch `/api/trace-check` through the deployed route. Its response trace ID should match the request's `traceparent` trace ID, and its stored SERVER span should have the browser CLIENT span as its parent on a forwarding-only path. Run [deployment verification](../../../verification.md) for the full test. A matching response establishes context extraction; inspect the exported span in Corridora to establish delivery. All trace-check responses are `no-store`; configure any intervening CDN to honor or explicitly bypass caching for the route.