docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a request filtering service for an Express.js application that prevents certain routes from being traced by OpenTelemetry instrumentation.
Your task is to create an Express.js HTTP server that implements request filtering to exclude specific endpoints from distributed tracing. The service should coordinate filtering across both HTTP and Express instrumentation layers to avoid creating partial traces.
Create an Express server on port 3000 with the following routes:
GET /api/data - Returns {"message": "data endpoint"}GET /health - Returns {"status": "healthy"}GET /metrics - Returns {"metrics": "system metrics"}GET /api/users/:id - Returns {"userId": "<id>", "name": "User <id>"}Configure OpenTelemetry instrumentation for your Express application with the following requirements:
/health and /metrics endpoints completely, preventing root span creation/api/data and /api/users/:id should create traces (both root HTTP spans and Express layer spans)/health and /metrics should NOT create any spans at allGET /api/data with correct JSON and creates traces @testGET /health with correct JSON but does NOT create any traces @testGET /metrics with correct JSON but does NOT create any traces @testGET /api/users/123 with correct JSON and creates traces @testProvides automatic instrumentation for Express.js applications to create spans for middleware, routers, and request handlers.
Provides automatic instrumentation for HTTP server and client requests, creating root spans for incoming requests.
Provides the OpenTelemetry NodeJS SDK for trace collection and processing.
Web application framework for Node.js.
// Express server that starts listening on port 3000
// Exports the configured Express app instance for testing
export const app: Express;
// Starts the server
export function startServer(): void;