File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 22
33/* eslint-disable no-console */
44const tracer = require ( '../packages/dd-trace' )
5- const { isTrue, isFalse } = require ( '../packages/dd-trace/src/util' )
65const log = require ( '../packages/dd-trace/src/log' )
76const { getEnvironmentVariable } = require ( '../packages/dd-trace/src/config-helper' )
7+ const { isCIVisibilityEnabled, isCiVisibilityAgentlessEnabled, getAPIKey } = require ( '../packages/dd-trace/src/config' )
88
99const PACKAGE_MANAGERS = [ 'npm' , 'yarn' , 'pnpm' ]
1010const DEFAULT_FLUSH_INTERVAL = 5000
@@ -42,8 +42,8 @@ const baseOptions = {
4242 flushInterval : isJestWorker ? JEST_FLUSH_INTERVAL : DEFAULT_FLUSH_INTERVAL
4343}
4444
45- let shouldInit = ! isFalse ( getEnvironmentVariable ( 'DD_CIVISIBILITY_ENABLED' ) )
46- const isAgentlessEnabled = isTrue ( getEnvironmentVariable ( 'DD_CIVISIBILITY_AGENTLESS_ENABLED' ) )
45+ let shouldInit = isCIVisibilityEnabled ( )
46+ const isAgentlessEnabled = isCiVisibilityAgentlessEnabled ( )
4747
4848if ( ! isTestWorker && isPackageManager ( ) ) {
4949 log . debug ( 'dd-trace is not initialized in a package manager.' )
@@ -57,7 +57,7 @@ if (isTestWorker) {
5757 }
5858} else {
5959 if ( isAgentlessEnabled ) {
60- if ( getEnvironmentVariable ( 'DD_API_KEY' ) ) {
60+ if ( getAPIKey ( ) ) {
6161 baseOptions . experimental = {
6262 exporter : 'datadog'
6363 }
Original file line number Diff line number Diff line change @@ -1464,6 +1464,17 @@ class Config {
14641464 }
14651465 }
14661466 }
1467+
1468+ isCIVisibilityEnabled ( ) {
1469+ return this . isCiVisibility
1470+ }
1471+
1472+ isCiVisibilityAgentlessEnabled ( ) {
1473+ return this . isCiVisibilityAgentless
1474+ }
1475+
1476+ getAPIKey ( ) {
1477+ return this . apiKey
14671478}
14681479
14691480function handleOtel ( tagString ) {
You can’t perform that action at this time.
0 commit comments