Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

mysql plugin does not propagate fields parameter in query callback wrapper #1324

@shuaibiyy

Description

@shuaibiyy

Environment details

  • OS: 10.15.7
  • Node.js version: v10.22.1
  • npm version: 6.14.6
  • @google-cloud/trace-agent version: 5.1.1

Steps to reproduce

In the mysql plugin's callback wrapper, the fields parameter is not accepted and forwarded.

const fn = function (err, res) {

It should be like this based on the mysql api:

function wrapCallback(api, span, done) {
    const fn = function (err, res, fields) { // <-- additional `fields` parameter
        if (api.enhancedDatabaseReportingEnabled()) {
            if (err) {
                span.addLabel('error', err);
            }
            if (res) {
                span.addLabel('result', res);
            }
        }
        span.endSpan();
        if (done) {
            done(err, res, fields); // <-- pass `fields` argument
        }
    };
    return api.wrap(fn);
}

I'm happy to create a PR to fix this. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    🚨This issue needs some love.api: cloudtraceIssues related to the googleapis/cloud-trace-nodejs API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions