Neocon Propaganda Machine

    tctx
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.10 • Public • Published

    tctx

    npm add tctx makes Trace Contexts simple


    Features

    • Lightweightsee.

    • Efficient — Effective reuse of memory between children see benchmarks.

    • Producer Friendly — Are you a browser? make() and go home.

    ⚙️ Install

    npm add tctx

    🚀 Usage

    // producer
    
    import { make } from 'tctx';
    
    fetch('/api', {
      headers: {
        traceparent: make(),
      },
    });
    
    // consumer
    
    import { parse } from 'tctx';
    
    const parent = parse(request.headers.traceparent);
    const id = parent.child();
    
    fetch('/downstream', {
      headers: {
        traceparent: id,
      },
    });

    💨 Benchmark

    via the /bench directory with Node v16.12.0

    Validation :: make
    ✔ tctx
    ✔ TraceParent
    
    Benchmark :: make
      tctx                   x 226,914 ops/sec ±1.69% (82 runs sampled)
      TraceParent            x 52,308 ops/sec ±3.87% (78 runs sampled)
    
    Validation :: parse
    ✔ tctx
    ✔ TraceParent
    
    Benchmark :: parse
      tctx                   x 3,923,503 ops/sec ±0.44% (94 runs sampled)
      TraceParent            x 120,083 ops/sec ±4.15% (76 runs sampled)
    
    Validation :: child
    ✔ tctx
    ✔ TraceParent
    
    Benchmark :: child
      tctx                   x 123,069 ops/sec ±3.40% (69 runs sampled)
      TraceParent            x 39,435 ops/sec ±2.84% (79 runs sampled)
    

    License

    MIT © Marais Rossouw

    Install

    npm i tctx

    DownloadsWeekly Downloads

    358

    Version

    0.0.10

    License

    MIT

    Unpacked Size

    11 kB

    Total Files

    6

    Last publish

    Collaborators

    • marais