Skip to content

Commit

Permalink
fix: Attach mysql tracing to Connection.createQuery instead of Connec…
Browse files Browse the repository at this point in the history
…tion.prototype.query (#3353)
  • Loading branch information
zchristopoulos committed Mar 30, 2021
1 parent 9af3095 commit a081cdf
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/tracing/src/integrations/mysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { EventProcessor, Integration } from '@sentry/types';
import { dynamicRequire, fill, logger } from '@sentry/utils';

interface MysqlConnection {
prototype: {
query: () => void;
};
createQuery: () => void;
}

/** Tracing integration for node-mysql package */
Expand Down Expand Up @@ -38,7 +36,7 @@ export class Mysql implements Integration {
// function (callback) => void
// function (options, callback) => void
// function (options, values, callback) => void
fill(connection.prototype, 'query', function(orig: () => void) {
fill(connection, 'createQuery', function(orig: () => void) {
return function(this: unknown, options: unknown, values: unknown, callback: unknown) {
const scope = getCurrentHub().getScope();
const parentSpan = scope?.getSpan();
Expand Down

0 comments on commit a081cdf

Please sign in to comment.