|
14 | 14 | expect(collector.waf.timeouts).to eq(0)
|
15 | 15 | expect(collector.waf.duration_ns).to eq(0)
|
16 | 16 | expect(collector.waf.duration_ext_ns).to eq(0)
|
| 17 | + expect(collector.waf.input_truncated_count).to eq(0) |
17 | 18 | end
|
18 | 19 | end
|
19 | 20 |
|
|
22 | 23 |
|
23 | 24 | let(:result) do
|
24 | 25 | Datadog::AppSec::SecurityEngine::Result::Ok.new(
|
25 |
| - events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 100, duration_ext_ns: 200 |
| 26 | + events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 100, |
| 27 | + duration_ext_ns: 200, input_truncated: false |
26 | 28 | )
|
27 | 29 | end
|
28 | 30 |
|
|
33 | 35 | expect(collector.waf.timeouts).to eq(0)
|
34 | 36 | expect(collector.waf.duration_ns).to eq(100)
|
35 | 37 | expect(collector.waf.duration_ext_ns).to eq(200)
|
| 38 | + expect(collector.waf.input_truncated_count).to eq(0) |
36 | 39 | end
|
37 | 40 | end
|
38 | 41 |
|
|
44 | 47 |
|
45 | 48 | let(:result_1) do
|
46 | 49 | Datadog::AppSec::SecurityEngine::Result::Ok.new(
|
47 |
| - events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 100, duration_ext_ns: 200 |
| 50 | + events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 100, |
| 51 | + duration_ext_ns: 200, input_truncated: false |
48 | 52 | )
|
49 | 53 | end
|
50 | 54 |
|
51 | 55 | let(:result_2) do
|
52 | 56 | Datadog::AppSec::SecurityEngine::Result::Match.new(
|
53 |
| - events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 1000, duration_ext_ns: 1200 |
| 57 | + events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 1000, |
| 58 | + duration_ext_ns: 1200, input_truncated: false |
54 | 59 | )
|
55 | 60 | end
|
56 | 61 |
|
|
60 | 65 | expect(collector.waf.errors).to eq(0)
|
61 | 66 | expect(collector.waf.duration_ns).to eq(1100)
|
62 | 67 | expect(collector.waf.duration_ext_ns).to eq(1400)
|
| 68 | + expect(collector.waf.input_truncated_count).to eq(0) |
63 | 69 | end
|
64 | 70 | end
|
65 | 71 |
|
|
72 | 78 |
|
73 | 79 | let(:result_1) do
|
74 | 80 | Datadog::AppSec::SecurityEngine::Result::Ok.new(
|
75 |
| - events: [], actions: {}, derivatives: {}, timeout: true, duration_ns: 100, duration_ext_ns: 500 |
| 81 | + events: [], actions: {}, derivatives: {}, timeout: true, duration_ns: 100, |
| 82 | + duration_ext_ns: 500, input_truncated: false |
76 | 83 | )
|
77 | 84 | end
|
78 | 85 |
|
79 | 86 | let(:result_2) do
|
80 | 87 | Datadog::AppSec::SecurityEngine::Result::Match.new(
|
81 |
| - events: [], actions: {}, derivatives: {}, timeout: true, duration_ns: 400, duration_ext_ns: 1200 |
| 88 | + events: [], actions: {}, derivatives: {}, timeout: true, duration_ns: 400, |
| 89 | + duration_ext_ns: 1200, input_truncated: false |
82 | 90 | )
|
83 | 91 | end
|
84 | 92 |
|
85 |
| - let(:result_3) { Datadog::AppSec::SecurityEngine::Result::Error.new(duration_ext_ns: 300) } |
| 93 | + let(:result_3) do |
| 94 | + Datadog::AppSec::SecurityEngine::Result::Error.new(duration_ext_ns: 300, input_truncated: false) |
| 95 | + end |
86 | 96 |
|
87 | 97 | it 'accumulates timeouts in addition to other metics' do
|
88 | 98 | expect(collector.waf.evals).to eq(3)
|
|
91 | 101 | expect(collector.waf.timeouts).to eq(2)
|
92 | 102 | expect(collector.waf.duration_ns).to eq(500)
|
93 | 103 | expect(collector.waf.duration_ext_ns).to eq(2000)
|
| 104 | + expect(collector.waf.input_truncated_count).to eq(0) |
94 | 105 | end
|
95 | 106 | end
|
96 | 107 | end
|
|
104 | 115 | expect(collector.rasp.timeouts).to eq(0)
|
105 | 116 | expect(collector.rasp.duration_ns).to eq(0)
|
106 | 117 | expect(collector.rasp.duration_ext_ns).to eq(0)
|
| 118 | + expect(collector.rasp.input_truncated_count).to eq(0) |
107 | 119 | end
|
108 | 120 | end
|
109 | 121 |
|
|
112 | 124 |
|
113 | 125 | let(:result) do
|
114 | 126 | Datadog::AppSec::SecurityEngine::Result::Ok.new(
|
115 |
| - events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 100, duration_ext_ns: 200 |
| 127 | + events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 100, |
| 128 | + duration_ext_ns: 200, input_truncated: false |
116 | 129 | )
|
117 | 130 | end
|
118 | 131 |
|
|
123 | 136 | expect(collector.rasp.timeouts).to eq(0)
|
124 | 137 | expect(collector.rasp.duration_ns).to eq(100)
|
125 | 138 | expect(collector.rasp.duration_ext_ns).to eq(200)
|
| 139 | + expect(collector.rasp.input_truncated_count).to eq(0) |
126 | 140 | end
|
127 | 141 | end
|
128 | 142 |
|
|
134 | 148 |
|
135 | 149 | let(:result_1) do
|
136 | 150 | Datadog::AppSec::SecurityEngine::Result::Ok.new(
|
137 |
| - events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 100, duration_ext_ns: 200 |
| 151 | + events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 100, |
| 152 | + duration_ext_ns: 200, input_truncated: false |
138 | 153 | )
|
139 | 154 | end
|
140 | 155 |
|
141 | 156 | let(:result_2) do
|
142 | 157 | Datadog::AppSec::SecurityEngine::Result::Match.new(
|
143 |
| - events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 1000, duration_ext_ns: 1200 |
| 158 | + events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 1000, |
| 159 | + duration_ext_ns: 1200, input_truncated: false |
144 | 160 | )
|
145 | 161 | end
|
146 | 162 |
|
|
151 | 167 | expect(collector.rasp.timeouts).to eq(0)
|
152 | 168 | expect(collector.rasp.duration_ns).to eq(1100)
|
153 | 169 | expect(collector.rasp.duration_ext_ns).to eq(1400)
|
| 170 | + expect(collector.rasp.input_truncated_count).to eq(0) |
154 | 171 | end
|
155 | 172 | end
|
156 | 173 |
|
|
163 | 180 |
|
164 | 181 | let(:result_1) do
|
165 | 182 | Datadog::AppSec::SecurityEngine::Result::Ok.new(
|
166 |
| - events: [], actions: {}, derivatives: {}, timeout: true, duration_ns: 100, duration_ext_ns: 500 |
| 183 | + events: [], actions: {}, derivatives: {}, timeout: true, duration_ns: 100, |
| 184 | + duration_ext_ns: 500, input_truncated: false |
167 | 185 | )
|
168 | 186 | end
|
169 | 187 |
|
170 | 188 | let(:result_2) do
|
171 | 189 | Datadog::AppSec::SecurityEngine::Result::Match.new(
|
172 |
| - events: [], actions: {}, derivatives: {}, timeout: true, duration_ns: 400, duration_ext_ns: 1200 |
| 190 | + events: [], actions: {}, derivatives: {}, timeout: true, duration_ns: 400, |
| 191 | + duration_ext_ns: 1200, |
| 192 | + input_truncated: false |
173 | 193 | )
|
174 | 194 | end
|
175 | 195 |
|
176 |
| - let(:result_3) { Datadog::AppSec::SecurityEngine::Result::Error.new(duration_ext_ns: 300) } |
| 196 | + let(:result_3) do |
| 197 | + Datadog::AppSec::SecurityEngine::Result::Error.new(duration_ext_ns: 300, input_truncated: false) |
| 198 | + end |
177 | 199 |
|
178 | 200 | it 'accumulates timeouts in addition to other metics' do
|
179 | 201 | expect(collector.rasp.evals).to eq(3)
|
|
182 | 204 | expect(collector.rasp.timeouts).to eq(2)
|
183 | 205 | expect(collector.rasp.duration_ns).to eq(500)
|
184 | 206 | expect(collector.rasp.duration_ext_ns).to eq(2000)
|
| 207 | + expect(collector.rasp.input_truncated_count).to eq(0) |
185 | 208 | end
|
186 | 209 | end
|
187 | 210 | end
|
|
0 commit comments