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(nodejs): add propagator auto-configuration #1459

Merged
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
3 changes: 2 additions & 1 deletion nodejs/packages/layer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
},
"dependencies": {
"@opentelemetry/api": "^1.7.0",
"@opentelemetry/exporter-trace-otlp-proto": "^0.52.1",
"@opentelemetry/auto-configuration-propagators": "^0.2.0",
"@opentelemetry/exporter-metrics-otlp-proto": "^0.52.1",
"@opentelemetry/exporter-trace-otlp-proto": "^0.52.1",
"@opentelemetry/instrumentation": "^0.52.1",
"@opentelemetry/instrumentation-aws-lambda": "^0.43.0",
"@opentelemetry/instrumentation-aws-sdk": "^0.43.0",
Expand Down
5 changes: 5 additions & 0 deletions nodejs/packages/layer/src/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { getEnv } from '@opentelemetry/core';
import { AwsLambdaInstrumentationConfig } from '@opentelemetry/instrumentation-aws-lambda';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto';
import { MeterProvider, MeterProviderOptions } from '@opentelemetry/sdk-metrics';
import { getPropagator } from '@opentelemetry/auto-configuration-propagators';

function defaultConfigureInstrumentations() {
// Use require statements for instrumentation to avoid having to have transitive dependencies on all the typescript
Expand Down Expand Up @@ -121,6 +122,10 @@ async function initializeProvider() {
if (typeof configureSdkRegistration === 'function') {
sdkRegistrationConfig = configureSdkRegistration(sdkRegistrationConfig);
}
// auto-configure propagator if not provided
if (!sdkRegistrationConfig.propagator) {
sdkRegistrationConfig.propagator = getPropagator();
}
tracerProvider.register(sdkRegistrationConfig);

// Configure default meter provider (doesn't export metrics)
Expand Down
Loading