Skip to content

Commit f20f97b

Browse files
committed
Fix typo and remove not needed headers
1 parent fd744c3 commit f20f97b

File tree

5 files changed

+13
-22
lines changed

5 files changed

+13
-22
lines changed

packages/dd-trace/src/appsec/iast/telemetry/logs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function sendLogs () {
2828
}
2929

3030
function isLevelEnabled (level) {
31-
return isLogCollectionEnabled(config) && (level !== 'DEBUG' || config.telemetry.diagnosticLogCollector)
31+
return isLogCollectionEnabled(config) && (level !== 'DEBUG' || config.telemetry.diagnosticLogCollection)
3232
}
3333

3434
function isLogCollectionEnabled (config) {

packages/dd-trace/src/telemetry/send-data.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const request = require('../exporters/common/request')
22

3-
function getHeaders (reqType, debug, application) {
3+
function getHeaders (reqType, config) {
4+
const debug = config.telemetry && config.telemetry.debug
5+
46
const headers = {
57
'content-type': 'application/json',
68
'dd-telemetry-api-version': 'v1',
@@ -9,10 +11,6 @@ function getHeaders (reqType, debug, application) {
911
if (debug) {
1012
headers['dd-telemetry-debug-enabled'] = 'true'
1113
}
12-
if (application) {
13-
headers['dd-client-library-language'] = application.language_name
14-
headers['dd-client-library-version'] = application.tracer_version
15-
}
1614
return headers
1715
}
1816

@@ -36,14 +34,13 @@ function sendData (config, application, host, reqType, payload = {}) {
3634
url
3735
} = config
3836

39-
const debug = config.telemetry && config.telemetry.debug
4037
const options = {
4138
url,
4239
hostname,
4340
port,
4441
method: 'POST',
4542
path: '/telemetry/proxy/api/v2/apmtelemetry',
46-
headers: getHeaders(reqType, debug, application)
43+
headers: getHeaders(reqType, config)
4744
}
4845
const data = JSON.stringify({
4946
api_version: 'v1',

packages/dd-trace/test/appsec/iast/iast-log.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('IAST log', () => {
1010
config: {
1111
telemetry: {
1212
logCollection: true,
13-
diagnosticLogCollector: true
13+
diagnosticLogCollection: true
1414
}
1515
}
1616
}
@@ -19,7 +19,7 @@ describe('IAST log', () => {
1919
config: {
2020
telemetry: {
2121
logCollection: true,
22-
diagnosticLogCollector: false
22+
diagnosticLogCollection: false
2323
}
2424
}
2525
}

packages/dd-trace/test/appsec/iast/telemetry/logs.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ describe('telemetry logs', () => {
134134
const app = {}
135135
const host = {}
136136

137-
it('should be called with DEBUG level and error if config.telemetry.diagnosticLogCollector = true', () => {
137+
it('should be called with DEBUG level and error if config.telemetry.diagnosticLogCollection = true', () => {
138138
const logCollectorAdd = sinon.stub()
139139
const logs = proxyquire('../../../../src/appsec/iast/telemetry/logs', {
140140
'../../../../../diagnostics_channel': dc,
@@ -144,7 +144,7 @@ describe('telemetry logs', () => {
144144
})
145145
logs.start()
146146

147-
onTelemetryStartMsg.config.telemetry.diagnosticLogCollector = true
147+
onTelemetryStartMsg.config.telemetry.diagnosticLogCollection = true
148148
onTelemetryStartMsg.application = app
149149
onTelemetryStartMsg.host = host
150150
onTelemetryStart()(onTelemetryStartMsg)
@@ -156,7 +156,7 @@ describe('telemetry logs', () => {
156156
expect(logCollectorAdd).to.be.calledOnceWith(match({ message: 'test', level: 'DEBUG', stack_trace: stack }))
157157
})
158158

159-
it('should be not called with DEBUG level if config.telemetry.diagnosticLogCollector = false', () => {
159+
it('should be not called with DEBUG level if config.telemetry.diagnosticLogCollection = false', () => {
160160
const logCollectorAdd = sinon.stub()
161161
const logs = proxyquire('../../../../src/appsec/iast/telemetry/logs', {
162162
'../../../../../diagnostics_channel': dc,

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

+3-9
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ describe('sendData', () => {
3434
headers: {
3535
'content-type': 'application/json',
3636
'dd-telemetry-api-version': 'v1',
37-
'dd-telemetry-request-type': 'req-type',
38-
'dd-client-library-language': application.language_name,
39-
'dd-client-library-version': application.tracer_version
37+
'dd-telemetry-request-type': 'req-type'
4038
},
4139
url: undefined,
4240
hostname: '',
@@ -59,9 +57,7 @@ describe('sendData', () => {
5957
headers: {
6058
'content-type': 'application/json',
6159
'dd-telemetry-api-version': 'v1',
62-
'dd-telemetry-request-type': 'req-type',
63-
'dd-client-library-language': application.language_name,
64-
'dd-client-library-version': application.tracer_version
60+
'dd-telemetry-request-type': 'req-type'
6561
},
6662
url: 'unix:/foo/bar/baz',
6763
hostname: undefined,
@@ -86,9 +82,7 @@ describe('sendData', () => {
8682
'content-type': 'application/json',
8783
'dd-telemetry-api-version': 'v1',
8884
'dd-telemetry-request-type': 'req-type',
89-
'dd-telemetry-debug-enabled': 'true',
90-
'dd-client-library-language': application.language_name,
91-
'dd-client-library-version': application.tracer_version
85+
'dd-telemetry-debug-enabled': 'true'
9286
},
9387
url: '/test',
9488
hostname: undefined,

0 commit comments

Comments
 (0)