or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-9/

Express Layer Type Analyzer

A diagnostic tool for Express.js applications that analyzes and classifies different types of layers in the middleware stack using OpenTelemetry instrumentation.

Capabilities

Layer Type Detection

  • It detects and correctly identifies Router layers @test
  • It detects and correctly identifies Middleware layers @test
  • It detects and correctly identifies Request Handler layers @test

Layer Information Collection

  • It collects layer name information from Express stack @test
  • It collects layer type information and maps to appropriate classifications @test

Instrumentation Integration

  • It integrates OpenTelemetry Express instrumentation to capture layer metadata @test
  • It extracts layer type attributes from generated spans @test

Implementation

@generates

API

/**
 * Analyzes an Express application and returns information about its layers.
 *
 * @param {Express.Application} app - The Express application to analyze
 * @returns {Promise<Array<{name: string, type: string}>>} Array of layer objects with name and type
 */
async function analyzeLayers(app) {
  // IMPLEMENTATION HERE
}

module.exports = {
  analyzeLayers
};

Requirements

The tool should:

  • Use OpenTelemetry Express instrumentation to detect and classify layers
  • Identify three types of layers: routers, middleware, and request handlers
  • Return structured information about each layer including its name and type
  • Handle a simple Express app with mixed layer types (at least one of each type)

Test Application Structure

The test should create an Express app with:

  • A router mounted at a specific path
  • At least one middleware function
  • At least one request handler

Then call analyzeLayers() to get classification results.

Dependencies { .dependencies }

@opentelemetry/instrumentation-express { .dependency }

Provides automatic instrumentation for Express.js applications with layer type detection and classification capabilities.

@opentelemetry/api { .dependency }

Provides OpenTelemetry API for tracing operations.

@opentelemetry/sdk-trace-base { .dependency }

Provides tracing SDK functionality for span collection.

express { .dependency }

The Express.js web framework to be analyzed.