Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/dd-trace/src/appsec/telemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ function updateRaspRequestsMetricTags (metrics, req, raspRuleType) {
if (!enabled) return

const tags = { rule_type: raspRuleType, waf_version: metrics.wafVersion }
appsecMetrics.count('appsec.rasp.rule.eval', tags).inc(1)
appsecMetrics.count('rasp.rule.eval', tags).inc(1)

if (metrics.wafTimeout) {
appsecMetrics.count('appsec.rasp.timeout', tags).inc(1)
appsecMetrics.count('rasp.timeout', tags).inc(1)
}

if (metrics.ruleTriggered) {
appsecMetrics.count('appsec.rasp.rule.match', tags).inc(1)
appsecMetrics.count('rasp.rule.match', tags).inc(1)
}
}

Expand Down
24 changes: 12 additions & 12 deletions packages/dd-trace/test/appsec/telemetry.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,41 +162,41 @@ describe('Appsec Telemetry metrics', () => {
})

describe('updateRaspRequestsMetricTags', () => {
it('should increment appsec.rasp.rule.eval metric', () => {
it('should increment rasp.rule.eval metric', () => {
appsecTelemetry.updateRaspRequestsMetricTags({
duration: 42,
durationExt: 52
}, req, 'rule-type')

expect(count).to.have.been.calledWith('appsec.rasp.rule.eval')
expect(count).to.not.have.been.calledWith('appsec.rasp.timeout')
expect(count).to.not.have.been.calledWith('appsec.rasp.rule.match')
expect(count).to.have.been.calledWith('rasp.rule.eval')
expect(count).to.not.have.been.calledWith('rasp.timeout')
expect(count).to.not.have.been.calledWith('rasp.rule.match')
expect(inc).to.have.been.calledOnceWith(1)
})

it('should increment appsec.rasp.timeout metric if timeout', () => {
it('should increment rasp.timeout metric if timeout', () => {
appsecTelemetry.updateRaspRequestsMetricTags({
duration: 42,
durationExt: 52,
wafTimeout: true
}, req, 'rule-type')

expect(count).to.have.been.calledWith('appsec.rasp.rule.eval')
expect(count).to.have.been.calledWith('appsec.rasp.timeout')
expect(count).to.not.have.been.calledWith('appsec.rasp.rule.match')
expect(count).to.have.been.calledWith('rasp.rule.eval')
expect(count).to.have.been.calledWith('rasp.timeout')
expect(count).to.not.have.been.calledWith('rasp.rule.match')
expect(inc).to.have.been.calledTwice
})

it('should increment appsec.rasp.rule.match metric if ruleTriggered', () => {
it('should increment rasp.rule.match metric if ruleTriggered', () => {
appsecTelemetry.updateRaspRequestsMetricTags({
duration: 42,
durationExt: 52,
ruleTriggered: true
}, req, 'rule-type')

expect(count).to.have.been.calledWith('appsec.rasp.rule.match')
expect(count).to.have.been.calledWith('appsec.rasp.rule.eval')
expect(count).to.not.have.been.calledWith('appsec.rasp.timeout')
expect(count).to.have.been.calledWith('rasp.rule.match')
expect(count).to.have.been.calledWith('rasp.rule.eval')
expect(count).to.not.have.been.calledWith('rasp.timeout')
expect(inc).to.have.been.calledTwice
})

Expand Down