Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add kafkajs instrumentation #38

Merged
merged 2 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
7 changes: 5 additions & 2 deletions test/.mocharc.integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

'use strict';

/* global module */
/* global module, require */

// eslint-disable-next-line @typescript-eslint/no-var-requires
const isCi = require('is-ci');

module.exports = {
extension: ['ts'],
Expand All @@ -14,5 +17,5 @@ module.exports = {
require: ['ts-node/register'],
slow: 3000,
spec: ['test/**/*test.ts'],
timeout: 10000,
timeout: isCi ? 20000 : 10000,
};