Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MariaDB support #1759

Open
pbstriker38 opened this issue May 20, 2020 · 2 comments · May be fixed by #4045
Open

MariaDB support #1759

pbstriker38 opened this issue May 20, 2020 · 2 comments · May be fixed by #4045
Labels
agent-nodejs Make available for APM Agents project planning. enhancement

Comments

@pbstriker38
Copy link

Would like automatic instrumentation for the MariaDB package.

https://www.npmjs.com/package/mariadb

I've forked the repo and am looking into how difficult this would be to implement.

@trentm trentm added the agent-nodejs Make available for APM Agents project planning. label Nov 16, 2020
@Nisgrak
Copy link

Nisgrak commented Feb 4, 2021

Any updates in this?

@pbstriker38
Copy link
Author

We are moving off of MariaDB so this is not a priority for us anymore. We implemented our own instrumentation using Sequelize hooks.

const sqlSummary = require("sql-summary");

sequelizeClient = new Sequelize(dbConfig);

sequelizeClient.addHook("beforeQuery", function(options, query) {
    const dbSpan = tracer.startSpan(
        null,
        { tags: { type: "db", subtype: "mariadb", action: "query" } }
    );
    options.context = { dbSpan: dbSpan };
});

sequelizeClient.addHook("afterQuery", function(options, query) {
    if (options.context.dbSpan) {
        if (query.sql) {
            options.context.dbSpan.setOperationName(sqlSummary(query.sql));
            options.context.dbSpan.setTag("query_string", query.sql);
        }

        options.context.dbSpan.finish();
    }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-nodejs Make available for APM Agents project planning. enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants