Skip to content
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
20 changes: 10 additions & 10 deletions aws-distro-opentelemetry-node-autoinstrumentation/src/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ export function setAwsDefaultEnvironmentVariables() {
process.env.OTEL_PROPAGATORS = 'baggage,xray,tracecontext';
}
if (!process.env.OTEL_NODE_DISABLED_INSTRUMENTATIONS) {
if (isAgentObservabilityEnabled()) {
// Assume users only need instrumentations that are manually set-up outside of OpenTelemetry
process.env.OTEL_NODE_DISABLED_INSTRUMENTATIONS =
'amqplib,aws-lambda,aws-sdk,bunyan,cassandra-driver,connect,cucumber,dataloader,dns,express,fastify,fs,generic-pool,graphql,grpc,hapi,http,ioredis,kafkajs,knex,koa,lru-memoizer,memcached,mongodb,mongoose,mysql2,mysql,nestjs-core,net,pg,pino,redis,redis-4,restify,router,socket.io,tedious,undici,winston';
} else {
// Disable the following instrumentations by default
// This auto-instrumentation for the `fs` module generates many low-value spans. `dns` is similar.
// https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1344#issuecomment-1618993178
process.env.OTEL_NODE_DISABLED_INSTRUMENTATIONS = 'fs,dns';
}
// Disable the following instrumentations by default
// This auto-instrumentation for the `fs` module generates many low-value spans. `dns` is similar.
// https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1344#issuecomment-1618993178
process.env.OTEL_NODE_DISABLED_INSTRUMENTATIONS = 'fs,dns';
}

if (isAgentObservabilityEnabled()) {
if (!process.env.OTEL_NODE_ENABLED_INSTRUMENTATIONS) {
// Assume users only need aws-sdk and aws-lambda instrumentations, as well as
// instrumentations that are manually set-up outside of OpenTelemetry
process.env.OTEL_NODE_ENABLED_INSTRUMENTATIONS = 'aws-lambda,aws-sdk';
}

// Set exporter defaults
if (!process.env.OTEL_TRACES_EXPORTER) {
process.env.OTEL_TRACES_EXPORTER = 'otlp';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('Register', function () {
delete process.env.OTEL_EXPORTER_OTLP_PROTOCOL;
delete process.env.OTEL_PROPAGATORS;
delete process.env.OTEL_NODE_DISABLED_INSTRUMENTATIONS;
delete process.env.OTEL_NODE_ENABLED_INSTRUMENTATIONS;

delete process.env.AWS_REGION;
delete process.env.AWS_DEFAULT_REGION;
Expand Down Expand Up @@ -100,9 +101,8 @@ describe('Register', function () {
expect(process.env.OTEL_METRICS_EXPORTER).toEqual('awsemf');
expect(process.env.OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT).toEqual('true');
expect(process.env.OTEL_TRACES_SAMPLER).toEqual('parentbased_always_on');
expect(process.env.OTEL_NODE_DISABLED_INSTRUMENTATIONS).toEqual(
'amqplib,aws-lambda,aws-sdk,bunyan,cassandra-driver,connect,cucumber,dataloader,dns,express,fastify,fs,generic-pool,graphql,grpc,hapi,http,ioredis,kafkajs,knex,koa,lru-memoizer,memcached,mongodb,mongoose,mysql2,mysql,nestjs-core,net,pg,pino,redis,redis-4,restify,router,socket.io,tedious,undici,winston'
);
expect(process.env.OTEL_NODE_DISABLED_INSTRUMENTATIONS).toEqual('fs,dns');
expect(process.env.OTEL_NODE_ENABLED_INSTRUMENTATIONS).toEqual('aws-lambda,aws-sdk');
expect(process.env.OTEL_AWS_APPLICATION_SIGNALS_ENABLED).toEqual('false');
expect(process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT).toEqual('https://xray.us-east-1.amazonaws.com/v1/traces');
expect(process.env.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT).toEqual('https://logs.us-east-1.amazonaws.com/v1/logs');
Expand Down
Loading