-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathclickhouse.ts
More file actions
40 lines (36 loc) · 1.08 KB
/
clickhouse.ts
File metadata and controls
40 lines (36 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import type { Span } from '@opentelemetry/api';
import type { IntegrationFn } from '@sentry/core';
import { defineIntegration } from '@sentry/core';
import { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';
import { ClickHouseInstrumentation } from './instrumentation'
const INTEGRATION_NAME = 'Clickhouse';
export const instrumentClickhouse = generateInstrumentOnce(
INTEGRATION_NAME,
() =>
new ClickHouseInstrumentation({
responseHook(span: Span) {
addOriginToSpan(span, 'auto.db.otel.clickhouse');
},
}),
);
const _clickhouseIntegration = (() => {
return {
name: INTEGRATION_NAME,
setupOnce() {
instrumentClickhouse();
},
};
}) satisfies IntegrationFn;
/**
* Adds Sentry tracing instrumentation for the [ClickHouse](https://www.npmjs.com/package/@clickhouse/client) library.
*
* @example
* ```javascript
* const Sentry = require('@sentry/node');
*
* Sentry.init({
* integrations: [Sentry.clickhouseIntegration()],
* });
* ```
*/
export const clickhouseIntegration = defineIntegration(_clickhouseIntegration);