File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
packages/node/src/integrations/tracing Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ import { fastifyIntegration, instrumentFastify } from './fastify';
88import { genericPoolIntegration , instrumentGenericPool } from './genericPool' ;
99import { graphqlIntegration , instrumentGraphql } from './graphql' ;
1010import { hapiIntegration , instrumentHapi } from './hapi' ;
11- import { instrumentKnex , knexIntegration } from './knex' ;
1211import { instrumentKafka , kafkaIntegration } from './kafka' ;
1312import { instrumentKoa , koaIntegration } from './koa' ;
1413import { instrumentLruMemoizer , lruMemoizerIntegration } from './lrumemoizer' ;
Original file line number Diff line number Diff line change @@ -19,12 +19,11 @@ const _knexIntegration = (() => {
1919
2020 setup ( client ) {
2121 client . on ( 'spanStart' , span => {
22- const spanJSON = spanToJSON ( span ) ;
23- const spanData = spanJSON . data ;
24-
25- if ( spanData && 'knex.version' in spanData ) {
22+ const { data } = spanToJSON ( span ) ;
23+ // knex.version is always set in the span data
24+ // https://github.com/open-telemetry/opentelemetry-js-contrib/blob/0309caeafc44ac9cb13a3345b790b01b76d0497d/plugins/node/opentelemetry-instrumentation-knex/src/instrumentation.ts#L138
25+ if ( data && 'knex.version' in data ) {
2626 span . setAttribute ( SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN , 'auto.db.otel.knex' ) ;
27- span . setAttribute ( 'db.system' , 'knex' ) ;
2827 }
2928 } ) ;
3029 } ,
@@ -34,6 +33,15 @@ const _knexIntegration = (() => {
3433/**
3534 * Knex integration
3635 *
37- * Capture tracing data for Knex.
36+ * Capture tracing data for [Knex](https://knexjs.org/).
37+ *
38+ * @example
39+ * ```javascript
40+ * import * as Sentry from '@sentry/node';
41+ *
42+ * Sentry.init({
43+ * integrations: [Sentry.knexIntegration()],
44+ * });
45+ * ```
3846 */
3947export const knexIntegration = defineIntegration ( _knexIntegration ) ;
You can’t perform that action at this time.
0 commit comments