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: allow toggling of instrumentations via env vars #769

Merged
merged 4 commits into from
Aug 1, 2023

Conversation

seemk
Copy link
Contributor

@seemk seemk commented Aug 1, 2023

Allow toggling instrumentations as is done in the Java instrumentation.

  • New environment variable OTEL_INSTRUMENTATION_COMMON_DEFAULT_ENABLED (default: true). When set to false, prevents the loading of all embedded (the ones we ship with the distro) instrumentations. This can be used to selectively switch on instrumentations, e.g. OTEL_INSTRUMENTATION_COMMON_DEFAULT_ENABLED=false OTEL_INSTRUMENTATION_PG_ENABLED=true will only enable pg instrumentation.

  • New environment variables with the pattern OTEL_INSTRUMENTATION_[NAME]_ENABLED, where [NAME] is the instrumentation name (see the below table). E.g. OTEL_INSTRUMENTATION_PG_ENABLED=false will just disable pg instrumentation.

⚠️ This only applies to instrumentations loaded by default in our distribution, when using the programmatic API to supply a list of user-specified instrumentations, it will have no effect.

All environment variables are case-insensitive, i.e. OTEL_INSTRUMENTATION_pg_ENABLED is the same as OTEL_INSTRUMENTATION_PG_ENABLED.

Instrumentation Environment variable name
@opentelemetry/instrumentation-amqplib amqplib
@opentelemetry/instrumentation-aws-sdk aws_sdk
@opentelemetry/instrumentation-bunyan bunyan
@opentelemetry/instrumentation-cassandra-driver cassandra_driver
@opentelemetry/instrumentation-connect connect
@opentelemetry/instrumentation-dataloader dataloader
@opentelemetry/instrumentation-dns dns
@opentelemetry/instrumentation-express express
@opentelemetry/instrumentation-fastify fastify
@opentelemetry/instrumentation-generic-pool generic_pool
@opentelemetry/instrumentation-graphql graphql
@opentelemetry/instrumentation-grpc grpc
@opentelemetry/instrumentation-hapi hapi
@opentelemetry/instrumentation-http http
@opentelemetry/instrumentation-ioredis ioredis
@opentelemetry/instrumentation-knex knex
@opentelemetry/instrumentation-koa koa
@opentelemetry/instrumentation-memcached memcached
@opentelemetry/instrumentation-mongodb mongodb
@opentelemetry/instrumentation-mongoose mongoose
@opentelemetry/instrumentation-mysql mysql
@opentelemetry/instrumentation-mysql2 mysql2
@opentelemetry/instrumentation-nestjs-core nestjs_core
@opentelemetry/instrumentation-net net
@opentelemetry/instrumentation-pg pg
@opentelemetry/instrumentation-pino pino
@opentelemetry/instrumentation-redis redis
@opentelemetry/instrumentation-redis-4 redis_4
@opentelemetry/instrumentation-restify restify
@opentelemetry/instrumentation-router router
@opentelemetry/instrumentation-tedious tedious
@opentelemetry/instrumentation-winston winston
elasticsearch elasticsearch
kafkajs kafkajs
sequelize sequelize
typeorm typeorm

@seemk seemk requested review from a team as code owners August 1, 2023 09:35
@seemk seemk merged commit 546bb25 into main Aug 1, 2023
72 checks passed
@seemk seemk deleted the env-enable-instrumentations branch August 1, 2023 10:21
@seemk seemk mentioned this pull request Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants