Skip to content

Latest commit

 

History

History

zipkin-instrumentation-postgres

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

zipkin-instrumentation-postgres

npm

This library will wrap the pg client.

Usage

const {Tracer} = require('zipkin');
const Postgres = require('pg');
const zipkinClient = require('zipkin-instrumentation-postgres');

const tracer = new Tracer({ctxImpl, recorder}); // configure your tracer properly here

const ZipkinPostgres = zipkinClient(tracer, Postgres);

const connectionOptions = {
  user: 'postgres',
  password: 'secret',
  host: 'localhost',
  database: 'mydb'
};

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);