简体   繁体   中英

Tracing Sequelize with AWS X-ray in Nodejs/Postgres

I am using Serverless NodeJs with PostgreSQL and want to start tracing Sequelize queries with AWS X-ray. The documentation only shows how we can trace the pg clients but doesn't state how we can do the same for Sequelize ORM. Can anyone help with this?

Your question is answered here on our github repo. The X-Ray Node SDK doesn't currently support tracing of sequelize queries. We have added it to our backlog. Please stay tuned.

Thanks!

This only capture db calls. This is how you can do it. dialect need to be specific

const Sequelize = require('sequelize');
const AWSXRay = require('aws-xray-sdk');
AWSXRay.captureHTTPsGlobal(require('https'));

const sequelize = () => {
    return new Sequelize(database, username, password, {
        host: host,
        dialect: 'mysql',
        dialectModule: AWSXRay.captureMySQL(require('mysql2')),
    });
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM