Skip to content

Commit 6a8e990

Browse files
committed
Suggestions
1 parent 60ac59b commit 6a8e990

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

packages/dd-trace/src/telemetry/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function start (aConfig, thePluginManager) {
116116
pluginManager = thePluginManager
117117
application = createAppObject()
118118
host = createHostObject()
119-
heartbeatInterval = config.telemetry.heartbeatInterval || 60000
119+
heartbeatInterval = config.telemetry.heartbeatInterval
120120

121121
dependencies.start(config, application, host)
122122
sendData(config, application, host, 'app-started', appStarted())

packages/dd-trace/test/config.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -786,19 +786,19 @@ describe('Config', () => {
786786

787787
expect(config.telemetry).to.not.be.undefined
788788
expect(config.telemetry.enabled).to.be.true
789-
expect(config.telemetry.heartbeatInterval).to.be.eq(60000)
789+
expect(config.telemetry.heartbeatInterval).to.eq(60000)
790790
expect(config.telemetry.logCollection).to.be.false
791791
expect(config.telemetry.diagnosticLogCollection).to.be.false
792792
expect(config.telemetry.debug).to.be.false
793793
})
794794

795-
it('should not set DD_TELEMETRY_HEARTBEAT_INTERVAL', () => {
795+
it('should set DD_TELEMETRY_HEARTBEAT_INTERVAL', () => {
796796
const origTelemetryHeartbeatIntervalValue = process.env.DD_TELEMETRY_HEARTBEAT_INTERVAL
797797
process.env.DD_TELEMETRY_HEARTBEAT_INTERVAL = '42'
798798

799799
const config = new Config()
800800

801-
expect(config.telemetry.heartbeatInterval).to.be.eq(42000)
801+
expect(config.telemetry.heartbeatInterval).to.eq(42000)
802802

803803
process.env.DD_TELEMETRY_HEARTBEAT_INTERVAL = origTelemetryHeartbeatIntervalValue
804804
})

packages/dd-trace/test/telemetry/send-data.spec.js

+15-10
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@ describe('sendData', () => {
1919
})
2020

2121
it('should call to request (TCP)', () => {
22-
sendDataModule.sendData({ hostname: '', port: '12345', tags: { 'runtime-id': '123' } },
23-
application, 'test', 'req-type')
22+
sendDataModule.sendData({
23+
hostname: '',
24+
port: '12345',
25+
tags: { 'runtime-id': '123' }
26+
},
27+
application, 'test', 'req-type')
2428
expect(request).to.have.been.calledOnce
2529
const options = request.getCall(0).args[1]
2630

@@ -41,8 +45,11 @@ describe('sendData', () => {
4145
})
4246

4347
it('should call to request (UDP)', () => {
44-
sendDataModule.sendData({ url: 'unix:/foo/bar/baz', tags: { 'runtime-id': '123' } },
45-
application, 'test', 'req-type')
48+
sendDataModule.sendData({
49+
url: 'unix:/foo/bar/baz',
50+
tags: { 'runtime-id': '123' }
51+
},
52+
application, 'test', 'req-type')
4653
expect(request).to.have.been.calledOnce
4754
const options = request.getCall(0).args[1]
4855

@@ -63,14 +70,12 @@ describe('sendData', () => {
6370
})
6471

6572
it('should add debug header if DD_TELEMETRY_DEBUG is present', () => {
66-
sendDataModule = proxyquire('../../src/telemetry/send-data', {
67-
'../exporters/common/request': request
68-
})
69-
70-
sendDataModule.sendData({ url: '/test',
73+
sendDataModule.sendData({
74+
url: '/test',
7175
tags: { 'runtime-id': '123' },
7276
telemetry: { debug: true }
73-
}, application, 'test', 'req-type')
77+
},
78+
application, 'test', 'req-type')
7479

7580
expect(request).to.have.been.calledOnce
7681
const options = request.getCall(0).args[1]

0 commit comments

Comments
 (0)