Skip to content

v1.2.0 - Request Tracing & Timeline

Choose a tag to compare

@simulieren simulieren released this 20 Feb 07:23
· 145 commits to main since this release

Per-Request Tracing with Timeline Visualization

New feature: trace every HTTP request with a waterfall timeline showing exactly what happened — DB queries, events, mail, and custom operations — in what order and how long each took.

New Features

  • Timeline tab in the debug panel — shows a list of recent requests with method, URL, status, duration, span count, and warnings
  • Waterfall chart — click any request to see a visual timeline of all operations, color-coded by category
  • Automatic span capture — DB queries (db:query) and console.warn calls are automatically captured within the request context
  • Custom spans — wrap any async code with trace() to add it to the timeline:
    import { trace } from 'adonisjs-server-stats'
    
    const result = await trace('fetchMembers', async () => {
      return OrganizationService.getMembers(orgId)
    })
  • Persistence — traces survive server restarts when persistDebugData is enabled

Configuration

export default defineConfig({
  devToolbar: {
    enabled: true,
    tracing: true,        // Enable request tracing
    maxTraces: 200,       // Ring buffer size (default: 200)
  },
})

Span Categories

Category Color Auto-captured
DB Purple ✅ db:query events
Request Blue ✅ Full request lifecycle
Mail Green —
Event Amber —
View Cyan —
Custom Gray Via trace() helper

New Exports

  • trace() — function to create custom spans
  • TraceSpan — type for individual spans
  • TraceRecord — type for complete request traces

API Endpoints

  • GET /admin/api/debug/traces — list recent traces (summary)
  • GET /admin/api/debug/traces/:id — full trace with spans