Skip to content

Commit 3efca0a

Browse files
committed
Remove DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED
1 parent ced1feb commit 3efca0a

File tree

5 files changed

+3
-130
lines changed

5 files changed

+3
-130
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.diagnosticLogCollection)
31+
return isLogCollectionEnabled(config) && level !== 'DEBUG'
3232
}
3333

3434
function isLogCollectionEnabled (config) {

packages/dd-trace/src/config.js

-5
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,6 @@ ken|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)
378378
process.env.DD_TELEMETRY_LOG_COLLECTION_ENABLED,
379379
DD_IAST_ENABLED
380380
)
381-
const DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED = coalesce(
382-
process.env.DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED,
383-
false
384-
)
385381

386382
const defaultIastRequestSampling = 30
387383
const iastRequestSampling = coalesce(
@@ -497,7 +493,6 @@ ken|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)
497493
enabled: DD_TRACE_EXPORTER !== 'datadog' && isTrue(DD_TRACE_TELEMETRY_ENABLED),
498494
heartbeatInterval: DD_TELEMETRY_HEARTBEAT_INTERVAL,
499495
logCollection: isTrue(DD_TELEMETRY_LOG_COLLECTION_ENABLED),
500-
diagnosticLogCollection: isTrue(DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED),
501496
debug: isTrue(DD_TELEMETRY_DEBUG)
502497
}
503498
this.protocolVersion = DD_TRACE_AGENT_PROTOCOL_VERSION

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

+1-86
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,10 @@ const ddBasePath = calculateDDBasePath(__dirname)
66
const EOL = '\n'
77

88
describe('IAST log', () => {
9-
const telemetryDebugConfig = {
10-
config: {
11-
telemetry: {
12-
logCollection: true,
13-
diagnosticLogCollection: true
14-
}
15-
}
16-
}
17-
189
const telemetryDefaultConfig = {
1910
config: {
2011
telemetry: {
21-
logCollection: true,
22-
diagnosticLogCollection: false
12+
logCollection: true
2313
}
2414
}
2515
}
@@ -77,81 +67,6 @@ describe('IAST log', () => {
7767
telemetryLogs.stop()
7868
})
7969

80-
describe('debug', () => {
81-
it('should call log.debug', () => {
82-
iastLog.debug('debug')
83-
84-
expect(log.debug).to.be.calledOnceWith('debug')
85-
})
86-
87-
it('should call log.debug and not publish msg via telemetry', () => {
88-
iastLog.debugAndPublish('debug')
89-
90-
expect(log.debug).to.be.calledOnceWith('debug')
91-
expect(telemetryLogs.publish).to.not.be.called
92-
})
93-
94-
it('should call log.debug and publish msg via telemetry', () => {
95-
onTelemetryStart(telemetryDebugConfig)
96-
97-
iastLog.debugAndPublish('debug')
98-
99-
expect(log.debug).to.be.calledOnceWith('debug')
100-
expect(telemetryLogs.publish).to.be.calledOnceWith({ message: 'debug', level: 'DEBUG' })
101-
})
102-
103-
it('should chain multiple debug calls', () => {
104-
onTelemetryStart(telemetryDebugConfig)
105-
106-
iastLog.debug('debug').debugAndPublish('debugAndPublish').debug('debug2')
107-
108-
expect(log.debug).to.be.calledThrice
109-
expect(log.debug.getCall(0).args[0]).to.be.eq('debug')
110-
expect(log.debug.getCall(1).args[0]).to.be.eq('debugAndPublish')
111-
expect(log.debug.getCall(2).args[0]).to.be.eq('debug2')
112-
expect(telemetryLogs.publish).to.be.calledOnceWith({ message: 'debugAndPublish', level: 'DEBUG' })
113-
})
114-
115-
it('should chain multiple debug calls', () => {
116-
onTelemetryStart(telemetryDebugConfig)
117-
118-
iastLog.debug('debug')
119-
120-
telemetryLogs.stop()
121-
122-
iastLog.debugAndPublish('debugAndPublish').debug('debug2')
123-
})
124-
})
125-
126-
describe('info', () => {
127-
it('should call log.info', () => {
128-
iastLog.info('info')
129-
130-
expect(log.info).to.be.calledOnceWith('info')
131-
})
132-
133-
it('should call log.info and publish msg via telemetry', () => {
134-
onTelemetryStart(telemetryDebugConfig)
135-
136-
iastLog.infoAndPublish('info')
137-
138-
expect(log.info).to.be.calledOnceWith('info')
139-
expect(telemetryLogs.publish).to.be.calledOnceWith({ message: 'info', level: 'DEBUG' })
140-
})
141-
142-
it('should chain multiple info calls', () => {
143-
onTelemetryStart(telemetryDebugConfig)
144-
145-
iastLog.info('info').infoAndPublish('infoAndPublish').info('info2')
146-
147-
expect(log.info).to.be.calledThrice
148-
expect(log.info.getCall(0).args[0]).to.be.eq('info')
149-
expect(log.info.getCall(1).args[0]).to.be.eq('infoAndPublish')
150-
expect(log.info.getCall(2).args[0]).to.be.eq('info2')
151-
expect(telemetryLogs.publish).to.be.calledOnceWith({ message: 'infoAndPublish', level: 'DEBUG' })
152-
})
153-
})
154-
15570
describe('warn', () => {
15671
it('should call log.warn', () => {
15772
iastLog.warn('warn')

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

+1-26
Original file line numberDiff line numberDiff line change
@@ -131,32 +131,7 @@ describe('telemetry logs', () => {
131131
})
132132

133133
describe('sendData', () => {
134-
const app = {}
135-
const host = {}
136-
137-
it('should be called with DEBUG level and error if config.telemetry.diagnosticLogCollection = true', () => {
138-
const logCollectorAdd = sinon.stub()
139-
const logs = proxyquire('../../../../src/appsec/iast/telemetry/logs', {
140-
'../../../../../diagnostics_channel': dc,
141-
'./log_collector': {
142-
add: logCollectorAdd
143-
}
144-
})
145-
logs.start()
146-
147-
onTelemetryStartMsg.config.telemetry.diagnosticLogCollection = true
148-
onTelemetryStartMsg.application = app
149-
onTelemetryStartMsg.host = host
150-
onTelemetryStart()(onTelemetryStartMsg)
151-
152-
const error = new Error('test')
153-
const stack = error.stack
154-
logs.publish({ message: error.message, stack_trace: stack, level: 'DEBUG' })
155-
156-
expect(logCollectorAdd).to.be.calledOnceWith(match({ message: 'test', level: 'DEBUG', stack_trace: stack }))
157-
})
158-
159-
it('should be not called with DEBUG level if config.telemetry.diagnosticLogCollection = false', () => {
134+
it('should be not called with DEBUG level', () => {
160135
const logCollectorAdd = sinon.stub()
161136
const logs = proxyquire('../../../../src/appsec/iast/telemetry/logs', {
162137
'../../../../../diagnostics_channel': dc,

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

-12
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,6 @@ describe('Config', () => {
788788
expect(config.telemetry.enabled).to.be.true
789789
expect(config.telemetry.heartbeatInterval).to.eq(60000)
790790
expect(config.telemetry.logCollection).to.be.false
791-
expect(config.telemetry.diagnosticLogCollection).to.be.false
792791
expect(config.telemetry.debug).to.be.false
793792
})
794793

@@ -836,17 +835,6 @@ describe('Config', () => {
836835
process.env.DD_IAST_ENABLED = origIastEnabledValue
837836
})
838837

839-
it('should set DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED = true', () => {
840-
const origDiagnosticLogCollectionValue = process.env.DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED
841-
process.env.DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED = 'true'
842-
843-
const config = new Config()
844-
845-
expect(config.telemetry.diagnosticLogCollection).to.be.true
846-
847-
process.env.DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED = origDiagnosticLogCollectionValue
848-
})
849-
850838
it('should set DD_TELEMETRY_DEBUG', () => {
851839
const origTelemetryDebugValue = process.env.DD_TELEMETRY_DEBUG
852840
process.env.DD_TELEMETRY_DEBUG = 'true'

0 commit comments

Comments
 (0)