Skip to content

Commit 8c04ae8

Browse files
committed
clean up integration
1 parent 60b6132 commit 8c04ae8

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

packages/node/src/integrations/tracing/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { fastifyIntegration, instrumentFastify } from './fastify';
88
import { genericPoolIntegration, instrumentGenericPool } from './genericPool';
99
import { graphqlIntegration, instrumentGraphql } from './graphql';
1010
import { hapiIntegration, instrumentHapi } from './hapi';
11-
import { instrumentKnex, knexIntegration } from './knex';
1211
import { instrumentKafka, kafkaIntegration } from './kafka';
1312
import { instrumentKoa, koaIntegration } from './koa';
1413
import { instrumentLruMemoizer, lruMemoizerIntegration } from './lrumemoizer';

packages/node/src/integrations/tracing/knex.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff 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
*/
3947
export const knexIntegration = defineIntegration(_knexIntegration);

0 commit comments

Comments
 (0)