-
Lightweight — Browser runtime has a single dep, otherwise slim see.
-
Efficient — Effective reuse of memory, and lazy.
-
Producer Friendly — Are you a browser?
make()
and go home. -
Quick — Get an id super performant.
npm add trcprnt
// producer
import { make } from 'trcprnt';
fetch('/api', {
headers: {
traceparent: make(),
},
});
// consumer
import { parse } from 'trcprnt';
const parent = parse(request.headers.traceparent);
const id = parent.child();
fetch('/downstream', {
headers: {
traceparent: id,
},
});
via the
/bench
directory with Node v16.12.0
Validation :: make
✔ trcprnt
✔ TraceParent
Benchmark :: make
trcprnt x 117,727 ops/sec ±1.65% (83 runs sampled)
TraceParent x 50,297 ops/sec ±3.65% (73 runs sampled)
Validation :: parse
✔ trcprnt
✔ TraceParent
Benchmark :: parse
trcprnt x 237,944 ops/sec ±0.56% (95 runs sampled)
TraceParent x 116,229 ops/sec ±4.15% (78 runs sampled)
Validation :: child
✔ trcprnt
✔ TraceParent
Benchmark :: child
trcprnt x 69,925 ops/sec ±2.35% (77 runs sampled)
TraceParent x 36,920 ops/sec ±3.45% (77 runs sampled)
MIT © Marais Rossouw