Skip to content

Commit

Permalink
enableMiddlewareTracing -> middlewareTracingEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
bengl committed Jan 29, 2025
1 parent ada7ede commit eefbd9f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('esm', () => {
})
}).timeout(50000)

it('disables middleware spans when config.enableMiddlewareTracing is set to false through environment variable', async () => {
it('disables middleware spans when config.middlewareTracingEnabled is set to false through environment variable', async () => {

Check failure on line 54 in packages/datadog-plugin-express/test/integration-test/client.spec.js

View workflow job for this annotation

GitHub Actions / lint

This line has a length of 131. Maximum allowed is 120
process.env.DD_TRACE_MIDDLEWARE_ENABLED = false
proc = await spawnPluginIntegrationTestProc(sandbox.folder, 'server.mjs', agent.port)
const numberOfSpans = 1
Expand Down
6 changes: 3 additions & 3 deletions packages/dd-trace/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ class Config {
this._setValue(defaults, 'lookup', undefined)
this._setValue(defaults, 'inferredProxyServicesEnabled', false)
this._setValue(defaults, 'memcachedCommandEnabled', false)
this._setValue(defaults, 'enableMiddlewareTracing', true)
this._setValue(defaults, 'middlewareTracingEnabled', true)
this._setValue(defaults, 'openAiLogsEnabled', false)
this._setValue(defaults, 'openaiSpanCharLimit', 128)
this._setValue(defaults, 'peerServiceMapping', {})
Expand Down Expand Up @@ -803,7 +803,7 @@ class Config {
this._setBoolean(env, 'logInjection', DD_LOGS_INJECTION)
// Requires an accompanying DD_APM_OBFUSCATION_MEMCACHED_KEEP_COMMAND=true in the agent
this._setBoolean(env, 'memcachedCommandEnabled', DD_TRACE_MEMCACHED_COMMAND_ENABLED)
this._setBoolean(env, 'enableMiddlewareTracing', DD_TRACE_MIDDLEWARE_ENABLED)
this._setBoolean(env, 'middlewareTracingEnabled', DD_TRACE_MIDDLEWARE_ENABLED)
this._setBoolean(env, 'openAiLogsEnabled', DD_OPENAI_LOGS_ENABLED)
this._setValue(env, 'openaiSpanCharLimit', maybeInt(DD_OPENAI_SPAN_CHAR_LIMIT))
this._envUnprocessed.openaiSpanCharLimit = DD_OPENAI_SPAN_CHAR_LIMIT
Expand Down Expand Up @@ -985,7 +985,7 @@ class Config {
this._setString(opts, 'llmobs.mlApp', options.llmobs?.mlApp)
this._setBoolean(opts, 'logInjection', options.logInjection)
this._setString(opts, 'lookup', options.lookup)
this._setBoolean(opts, 'enableMiddlewareTracing', options.enableMiddlewareTracing)
this._setBoolean(opts, 'middlewareTracingEnabled', options.middlewareTracingEnabled)
this._setBoolean(opts, 'openAiLogsEnabled', options.openAiLogsEnabled)
this._setValue(opts, 'peerServiceMapping', options.peerServiceMapping)
this._setBoolean(opts, 'plugins', options.plugins)
Expand Down
14 changes: 7 additions & 7 deletions packages/dd-trace/src/plugins/util/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const web = {
const validateStatus = getStatusValidator(config)
const hooks = getHooks(config)
const filter = urlFilter.getFilter(config)
const enableMiddlewareTracing = getMiddlewareSetting(config, tracerConfig)
const middlewareTracingEnabled = getMiddlewareSetting(config, tracerConfig)
const queryStringObfuscation = getQsObfuscator(config)

return {
Expand All @@ -54,7 +54,7 @@ const web = {
validateStatus,
hooks,
filter,
enableMiddlewareTracing,
middlewareTracingEnabled,
queryStringObfuscation
}
},
Expand Down Expand Up @@ -572,13 +572,13 @@ function getHooks (config) {

function getMiddlewareSetting (config, tracerConfig) {
if (config) {
if (typeof config.enableMiddlewareTracing === 'boolean') {
return config.enableMiddlewareTracing
} else if (config.hasOwnProperty('enableMiddlewareTracing')) {
log.error('Expected `enableMiddlewareTracing` to be a boolean.')
if (typeof config.middlewareTracingEnabled === 'boolean') {
return config.middlewareTracingEnabled
} else if (config.hasOwnProperty('middlewareTracingEnabled')) {
log.error('Expected `middlewareTracingEnabled` to be a boolean.')
}
}
if (tracerConfig && tracerConfig.enableMiddlewareTracing === false) {
if (tracerConfig && tracerConfig.middlewareTracingEnabled === false) {
return false
}

Expand Down

0 comments on commit eefbd9f

Please sign in to comment.