Skip to content

Commit

Permalink
adding test
Browse files Browse the repository at this point in the history
  • Loading branch information
mhlidd committed Dec 10, 2024
1 parent f9b8a41 commit f8c2afe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions packages/dd-trace/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,7 @@ class Config {
this._setBoolean(env, 'crashtracking.enabled', DD_CRASHTRACKING_ENABLED)
this._setBoolean(env, 'codeOriginForSpans.enabled', DD_CODE_ORIGIN_FOR_SPANS_ENABLED)
this._setString(env, 'dbmPropagationMode', DD_DBM_PROPAGATION_MODE)
this._setString(env, 'dogstatsd.hostname', DD_DOGSTATSD_HOSTNAME)
if (DD_DOGSTATSD_HOST) this._setString(env, 'dogstatsd.hostname', DD_DOGSTATSD_HOST)
this._setString(env, 'dogstatsd.hostname', DD_DOGSTATSD_HOST || DD_DOGSTATSD_HOSTNAME)
this._setString(env, 'dogstatsd.port', DD_DOGSTATSD_PORT)
this._setBoolean(env, 'dsmEnabled', DD_DATA_STREAMS_ENABLED)
this._setBoolean(env, 'dynamicInstrumentationEnabled', DD_DYNAMIC_INSTRUMENTATION_ENABLED)
Expand Down
9 changes: 9 additions & 0 deletions packages/dd-trace/test/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1836,6 +1836,15 @@ describe('Config', () => {
expect(config.appsec.apiSecurity.enabled).to.be.true
})

it('should prioritize DD_DOGSTATSD_HOST over DD_DOGSTATSD_HOSTNAME', () => {
process.env.DD_DOGSTATSD_HOSTNAME = 'dsd-agent'
process.env.DD_DOGSTATSD_HOST = 'localhost'

const config = new Config()

expect(config).to.have.nested.property('dogstatsd.hostname', 'localhost')
})

context('auto configuration w/ unix domain sockets', () => {
context('on windows', () => {
it('should not be used', () => {
Expand Down

0 comments on commit f8c2afe

Please sign in to comment.