@sentry-internal/tracing
Advanced tools
Comparing version 7.73.0 to 7.74.0
@@ -73,3 +73,3 @@ var { | ||
function finishSpan(span) { | ||
if (!span) { | ||
if (!span || span.endTimestamp) { | ||
return; | ||
@@ -118,5 +118,10 @@ } | ||
return orig.call(this, options, values, function () { | ||
// streaming, no callback! | ||
const query = orig.call(this, options, values) ; | ||
query.on('end', () => { | ||
finishSpan(span); | ||
}); | ||
return query; | ||
}; | ||
@@ -123,0 +128,0 @@ }); |
@@ -24,2 +24,3 @@ var { | ||
this._usePgNative = !!options.usePgNative; | ||
this._module = options.module; | ||
} | ||
@@ -48,3 +49,5 @@ | ||
if (this._usePgNative && !_optionalChain([pkg, 'access', _2 => _2.native, 'optionalAccess', _3 => _3.Client])) { | ||
const Client = this._usePgNative ? _optionalChain([pkg, 'access', _2 => _2.native, 'optionalAccess', _3 => _3.Client]) : pkg.Client; | ||
if (!Client) { | ||
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && utils.logger.error("Postgres Integration was unable to access 'pg-native' bindings."); | ||
@@ -54,4 +57,2 @@ return; | ||
const { Client } = this._usePgNative ? pkg.native : pkg; | ||
/** | ||
@@ -58,0 +59,0 @@ * function (query, callback) => void |
@@ -68,3 +68,3 @@ import { _optionalChain } from '@sentry/utils/esm/buildPolyfills'; | ||
function finishSpan(span) { | ||
if (!span) { | ||
if (!span || span.endTimestamp) { | ||
return; | ||
@@ -113,5 +113,10 @@ } | ||
return orig.call(this, options, values, function () { | ||
// streaming, no callback! | ||
const query = orig.call(this, options, values) ; | ||
query.on('end', () => { | ||
finishSpan(span); | ||
}); | ||
return query; | ||
}; | ||
@@ -118,0 +123,0 @@ }); |
@@ -19,2 +19,3 @@ import { _optionalChain } from '@sentry/utils/esm/buildPolyfills'; | ||
this._usePgNative = !!options.usePgNative; | ||
this._module = options.module; | ||
} | ||
@@ -43,3 +44,5 @@ | ||
if (this._usePgNative && !_optionalChain([pkg, 'access', _2 => _2.native, 'optionalAccess', _3 => _3.Client])) { | ||
const Client = this._usePgNative ? _optionalChain([pkg, 'access', _2 => _2.native, 'optionalAccess', _3 => _3.Client]) : pkg.Client; | ||
if (!Client) { | ||
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.error("Postgres Integration was unable to access 'pg-native' bindings."); | ||
@@ -49,4 +52,2 @@ return; | ||
const { Client } = this._usePgNative ? pkg.native : pkg; | ||
/** | ||
@@ -53,0 +54,0 @@ * function (query, callback) => void |
{ | ||
"name": "@sentry-internal/tracing", | ||
"version": "7.73.0", | ||
"version": "7.74.0", | ||
"description": "Sentry Internal Tracing Package", | ||
@@ -26,5 +26,5 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/core": "7.73.0", | ||
"@sentry/types": "7.73.0", | ||
"@sentry/utils": "7.73.0", | ||
"@sentry/core": "7.74.0", | ||
"@sentry/types": "7.74.0", | ||
"@sentry/utils": "7.74.0", | ||
"tslib": "^2.4.1 || ^1.9.3" | ||
@@ -31,0 +31,0 @@ }, |
import { Hub } from '@sentry/core'; | ||
import { EventProcessor } from '@sentry/types'; | ||
import { LazyLoadedIntegration } from './lazy'; | ||
type PgClientQuery = (config: unknown, values?: unknown, callback?: (err: unknown, result: unknown) => void) => void | Promise<unknown>; | ||
interface PgClient { | ||
prototype: { | ||
query: () => void | Promise<unknown>; | ||
query: PgClientQuery; | ||
}; | ||
@@ -11,2 +12,16 @@ } | ||
usePgNative?: boolean; | ||
/** | ||
* Supply your postgres module directly, instead of having Sentry attempt automatic resolution. | ||
* Use this if you (a) use a module that's not `pg`, or (b) use a bundler that breaks resolution (e.g. esbuild). | ||
* | ||
* Usage: | ||
* ``` | ||
* import pg from 'pg'; | ||
* | ||
* Sentry.init({ | ||
* integrations: [new Sentry.Integrations.Postgres({ module: pg })], | ||
* }); | ||
* ``` | ||
*/ | ||
module?: PGModule; | ||
} | ||
@@ -17,3 +32,3 @@ type PGModule = { | ||
Client: PgClient; | ||
}; | ||
} | null; | ||
}; | ||
@@ -20,0 +35,0 @@ /** Tracing integration for node-postgres package */ |
import type { Hub } from '@sentry/core'; | ||
import type { EventProcessor } from '@sentry/types'; | ||
import type { LazyLoadedIntegration } from './lazy'; | ||
type PgClientQuery = (config: unknown, values?: unknown, callback?: (err: unknown, result: unknown) => void) => void | Promise<unknown>; | ||
interface PgClient { | ||
prototype: { | ||
query: () => void | Promise<unknown>; | ||
query: PgClientQuery; | ||
}; | ||
@@ -11,2 +12,16 @@ } | ||
usePgNative?: boolean; | ||
/** | ||
* Supply your postgres module directly, instead of having Sentry attempt automatic resolution. | ||
* Use this if you (a) use a module that's not `pg`, or (b) use a bundler that breaks resolution (e.g. esbuild). | ||
* | ||
* Usage: | ||
* ``` | ||
* import pg from 'pg'; | ||
* | ||
* Sentry.init({ | ||
* integrations: [new Sentry.Integrations.Postgres({ module: pg })], | ||
* }); | ||
* ``` | ||
*/ | ||
module?: PGModule; | ||
} | ||
@@ -17,3 +32,3 @@ type PGModule = { | ||
Client: PgClient; | ||
}; | ||
} | null; | ||
}; | ||
@@ -20,0 +35,0 @@ /** Tracing integration for node-postgres package */ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
947769
7975
+ Added@sentry/core@7.74.0(transitive)
+ Added@sentry/types@7.74.0(transitive)
+ Added@sentry/utils@7.74.0(transitive)
- Removed@sentry/core@7.73.0(transitive)
- Removed@sentry/types@7.73.0(transitive)
- Removed@sentry/utils@7.73.0(transitive)
Updated@sentry/core@7.74.0
Updated@sentry/types@7.74.0
Updated@sentry/utils@7.74.0