Skip to content

Commit

Permalink
feat: add kafkajs instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
basti1302 committed Jul 2, 2024
1 parent 7c90935 commit b33d7dc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"@opentelemetry/exporter-logs-otlp-proto": "^0.52.1",
"@opentelemetry/exporter-metrics-otlp-proto": "^0.52.1",
"@opentelemetry/exporter-trace-otlp-proto": "^0.52.1",
"@opentelemetry/instrumentation-kafkajs": "^0.1.0",
"@opentelemetry/resource-detector-container": "^0.3.11",
"@opentelemetry/resources": "^1.25.1",
"@opentelemetry/sdk-logs": "^0.52.1",
Expand Down
7 changes: 6 additions & 1 deletion src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
import { NodeSDK, NodeSDKConfiguration } from '@opentelemetry/sdk-node';
import { BatchSpanProcessor, SpanProcessor } from '@opentelemetry/sdk-trace-base';
import { ConsoleSpanExporter } from '@opentelemetry/sdk-trace-node';
import { KafkaJsInstrumentation } from '@opentelemetry/instrumentation-kafkajs';

import PodUidDetector from './detectors/node/opentelemetry-resource-detector-kubernetes-pod';
import ServiceNameFallbackDetector from './detectors/node/opentelemetry-resource-detector-service-name-fallback';
Expand Down Expand Up @@ -63,7 +64,11 @@ const configuration: Partial<NodeSDKConfiguration> = {
spanProcessors: spanProcessors(),
metricReader: metricsReader(),
logRecordProcessor: logRecordProcessor(),
instrumentations: [getNodeAutoInstrumentations(createInstrumentationConfig())],
instrumentations: [
//
getNodeAutoInstrumentations(createInstrumentationConfig()),
new KafkaJsInstrumentation(),
],
resource: resource(),
resourceDetectors: resourceDetectors(),
};
Expand Down

0 comments on commit b33d7dc

Please sign in to comment.