Skip to content

zipkin-js v0.11

Compare
Choose a tag to compare
@codefromthecrypt codefromthecrypt released this 22 Nov 14:21
· 407 commits to master since this release

zipkin-js v0.11 adds PostgreSQL, TypeScript, http customization and local tracing apis.

We're quite lucky to have a community producing works like this. Don't forget to watch our repo for change you're interested in!

PostgreSQL

Those familiar with Zipkin change culture know that we aim for high quality implementations that are desired by multiple parties (rule-of-three). Thanks to @voldern, we now have client instrumentation for postgreql and thanks to our community speaking up in favor, it is merged!

Here's a snippet from the README:

const client = new ZipkinPostgres.Client(connectionOptions);
const pool = new ZipkinPostgres.Pool(connectionOptions);

// Your application code here
client.query('SELECT NOW()', (err, result) => {
  console.log(err, result);
});

pool.query('SELECT NOW()')
  .then(console.log)
  .catch(console.error);

TypeScript

TypeScript is quickly catching fire in our repository. Many thanks to @yonran and @pbadenski for fleshing out declaration files, covering our base api, all transports and a couple instrumentation packages. Keep an eye out or roll up your sleeves to help complete the job!

Http transport customizations

Some folks proxy zipkin, adding aspects such as oauth they might need. Thanks to @voldern, you can now customize headers used to transport spans, such as adding authorization.

const recorder = new BatchRecorder({
  logger: new HttpLogger({
    endpoint: 'http://your_host:9411/api/v2/spans',
    jsonEncoder: JSON_V2,
    headers: {'Authorization': 'secret'} // optional custom HTTP headers
  })
});

Local tracing

Local tracing is capturing activity that starts before remote service calls, or in-between them. This can be used to label code in a client, such as react-native, or a notable operation you need to pay attention to for SLA reasons. Thanks to a lot of help from @eirslett @DanielMSchmidt and @sundarsy, we now have a new api command Tracer.local which wraps synchronous or promise results.

Here's an example tracing a synchronous function:

// A span representing checkout completes before result is returned
const result = tracer.local('checkout', () => {
  return someComputation();
});

Here's an example tracing a function that returns a promise:

// A span is in progress and completes when the promise is resolved.
const result = tracer.local('checkout', () => {
  return createAPromise();
});

Look at our README or our example node or React Native projects for local tracing in action!