(
&mut self,
rng: &mut StdRng,
host: &str,
pod: &str,
service: &str,
container: &str,
image: &str,
time: i64,
)
| 131 | |
| 132 | #[expect(clippy::too_many_arguments)] |
| 133 | fn append_row( |
| 134 | &mut self, |
| 135 | rng: &mut StdRng, |
| 136 | host: &str, |
| 137 | pod: &str, |
| 138 | service: &str, |
| 139 | container: &str, |
| 140 | image: &str, |
| 141 | time: i64, |
| 142 | ) { |
| 143 | self.row_count += 1; |
| 144 | |
| 145 | let methods = &["GET", "PUT", "POST", "HEAD", "PATCH", "DELETE"]; |
| 146 | let status = &[200, 204, 400, 503, 403]; |
| 147 | |
| 148 | self.service.append(service).unwrap(); |
| 149 | self.host.append(host).unwrap(); |
| 150 | self.pod.append(pod).unwrap(); |
| 151 | self.container.append(container).unwrap(); |
| 152 | self.image.append(image).unwrap(); |
| 153 | self.time.append_value(time); |
| 154 | |
| 155 | if self.options.include_nulls { |
| 156 | // Append a null value if the option is set |
| 157 | // Use both "NULL" as a string and a null value |
| 158 | if rng.random_bool(0.5) { |
| 159 | self.client_addr.append_null(); |
| 160 | } else { |
| 161 | self.client_addr.append_value("NULL"); |
| 162 | } |
| 163 | } else { |
| 164 | self.client_addr.append_value(format!( |
| 165 | "{}.{}.{}.{}", |
| 166 | rng.random::<u8>(), |
| 167 | rng.random::<u8>(), |
| 168 | rng.random::<u8>(), |
| 169 | rng.random::<u8>() |
| 170 | )); |
| 171 | } |
| 172 | self.request_duration.append_value(rng.random()); |
| 173 | self.request_user_agent |
| 174 | .append_value(random_string(rng, 20..100)); |
| 175 | self.request_method |
| 176 | .append_value(methods[rng.random_range(0..methods.len())]); |
| 177 | self.request_host |
| 178 | .append_value(format!("https://{service}.mydomain.com")); |
| 179 | |
| 180 | self.request_bytes |
| 181 | .append_option(rng.random_bool(0.9).then(|| rng.random())); |
| 182 | self.response_bytes |
| 183 | .append_option(rng.random_bool(0.9).then(|| rng.random())); |
| 184 | self.response_status |
| 185 | .append_value(status[rng.random_range(0..status.len())]); |
| 186 | self.prices_status.append_value(self.row_count as i128); |
| 187 | } |
| 188 | |
| 189 | fn finish(mut self, schema: SchemaRef) -> RecordBatch { |
| 190 | RecordBatch::try_new( |
no test coverage detected