Skip to content

Commit 9c6e278

Browse files
authored
[Agent Observability] Update default enabled instrumentation list for Agent Observability (#211)
*Issue #, if available:* *Description of changes:* By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent e5b50a9 commit 9c6e278

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

aws-distro-opentelemetry-node-autoinstrumentation/src/register.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ export function setAwsDefaultEnvironmentVariables() {
4747
process.env.OTEL_PROPAGATORS = 'baggage,xray,tracecontext';
4848
}
4949
if (!process.env.OTEL_NODE_DISABLED_INSTRUMENTATIONS) {
50-
if (isAgentObservabilityEnabled()) {
51-
// Assume users only need instrumentations that are manually set-up outside of OpenTelemetry
52-
process.env.OTEL_NODE_DISABLED_INSTRUMENTATIONS =
53-
'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';
54-
} else {
55-
// Disable the following instrumentations by default
56-
// This auto-instrumentation for the `fs` module generates many low-value spans. `dns` is similar.
57-
// https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1344#issuecomment-1618993178
58-
process.env.OTEL_NODE_DISABLED_INSTRUMENTATIONS = 'fs,dns';
59-
}
50+
// Disable the following instrumentations by default
51+
// This auto-instrumentation for the `fs` module generates many low-value spans. `dns` is similar.
52+
// https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1344#issuecomment-1618993178
53+
process.env.OTEL_NODE_DISABLED_INSTRUMENTATIONS = 'fs,dns';
6054
}
6155

6256
if (isAgentObservabilityEnabled()) {
57+
if (!process.env.OTEL_NODE_ENABLED_INSTRUMENTATIONS) {
58+
// Assume users only need aws-sdk and aws-lambda instrumentations, as well as
59+
// instrumentations that are manually set-up outside of OpenTelemetry
60+
process.env.OTEL_NODE_ENABLED_INSTRUMENTATIONS = 'aws-lambda,aws-sdk';
61+
}
62+
6363
// Set exporter defaults
6464
if (!process.env.OTEL_TRACES_EXPORTER) {
6565
process.env.OTEL_TRACES_EXPORTER = 'otlp';

aws-distro-opentelemetry-node-autoinstrumentation/test/register.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ describe('Register', function () {
2828
delete process.env.OTEL_EXPORTER_OTLP_PROTOCOL;
2929
delete process.env.OTEL_PROPAGATORS;
3030
delete process.env.OTEL_NODE_DISABLED_INSTRUMENTATIONS;
31+
delete process.env.OTEL_NODE_ENABLED_INSTRUMENTATIONS;
3132

3233
delete process.env.AWS_REGION;
3334
delete process.env.AWS_DEFAULT_REGION;
@@ -100,9 +101,8 @@ describe('Register', function () {
100101
expect(process.env.OTEL_METRICS_EXPORTER).toEqual('awsemf');
101102
expect(process.env.OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT).toEqual('true');
102103
expect(process.env.OTEL_TRACES_SAMPLER).toEqual('parentbased_always_on');
103-
expect(process.env.OTEL_NODE_DISABLED_INSTRUMENTATIONS).toEqual(
104-
'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'
105-
);
104+
expect(process.env.OTEL_NODE_DISABLED_INSTRUMENTATIONS).toEqual('fs,dns');
105+
expect(process.env.OTEL_NODE_ENABLED_INSTRUMENTATIONS).toEqual('aws-lambda,aws-sdk');
106106
expect(process.env.OTEL_AWS_APPLICATION_SIGNALS_ENABLED).toEqual('false');
107107
expect(process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT).toEqual('https://xray.us-east-1.amazonaws.com/v1/traces');
108108
expect(process.env.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT).toEqual('https://logs.us-east-1.amazonaws.com/v1/logs');

0 commit comments

Comments
 (0)