Skip to content

feat(nodejs): configureAwsInstrumentation for downstream #1375

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

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Changes from 1 commit
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
11 changes: 7 additions & 4 deletions nodejs/packages/layer/src/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
envDetector,
processDetector,
} from '@opentelemetry/resources';
import { AwsInstrumentation } from '@opentelemetry/instrumentation-aws-sdk';
import { AwsInstrumentation, AwsSdkInstrumentationConfig } from '@opentelemetry/instrumentation-aws-sdk';
import { AwsLambdaInstrumentation } from '@opentelemetry/instrumentation-aws-lambda';
import {
diag,
Expand Down Expand Up @@ -58,6 +58,7 @@ function defaultConfigureInstrumentations() {

declare global {
// in case of downstream configuring span processors etc
function configureAwsInstrumentation(defaultConfig: AwsSdkInstrumentationConfig): AwsSdkInstrumentationConfig
function configureTracerProvider(tracerProvider: NodeTracerProvider): void
function configureTracer(defaultConfig: NodeTracerConfig): NodeTracerConfig;
function configureSdkRegistration(
Expand All @@ -72,9 +73,11 @@ declare global {
console.log('Registering OpenTelemetry');

const instrumentations = [
new AwsInstrumentation({
suppressInternalInstrumentation: true,
}),
new AwsInstrumentation(
typeof configureAwsInstrumentation === 'function'
? configureAwsInstrumentation({suppressInternalInstrumentation: true})
: {suppressInternalInstrumentation: true,},
),
new AwsLambdaInstrumentation(typeof configureLambdaInstrumentation === 'function' ? configureLambdaInstrumentation({}) : {}),
...(typeof configureInstrumentations === 'function' ? configureInstrumentations: defaultConfigureInstrumentations)()
];
Expand Down