vercel / tracing-js

An implementation of Opentracing API for honeycomb.io

Home Page:https://npmjs.com/@vercel/tracing-js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add deterministic sampling

styfle opened this issue · comments

We need a way to set the sampling rate but this really only needs to happen once, probably in the tracer.

Something like this

const tracer = new Tracer('service-name', {
  writeKey: process.env.HONEYCOMB_KEY,
  dataset: process.env.HONEYCOMB_DATASET,
  deterministicSampleRate: process.env.HONEYCOMB_SAMPLE_RATE,
});

This will initialize a new instance of the Deterministic sampler.

Then all spans can use this in the finish() method to basically skip sending the data.