Return an object suitable for tracking metrics for the given compute instance.
(&self, instance_id: ComputeInstanceId)
| 197 | |
| 198 | /// Return an object suitable for tracking metrics for the given compute instance. |
| 199 | pub fn for_instance(&self, instance_id: ComputeInstanceId) -> InstanceMetrics { |
| 200 | let labels = vec![instance_id.to_string()]; |
| 201 | let replica_count = self.replica_count.get_delete_on_drop_metric(labels.clone()); |
| 202 | let collection_count = self |
| 203 | .collection_count |
| 204 | .get_delete_on_drop_metric(labels.clone()); |
| 205 | let collection_unscheduled_count = self |
| 206 | .collection_unscheduled_count |
| 207 | .get_delete_on_drop_metric(labels.clone()); |
| 208 | let peek_count = self.peek_count.get_delete_on_drop_metric(labels.clone()); |
| 209 | let subscribe_count = self |
| 210 | .subscribe_count |
| 211 | .get_delete_on_drop_metric(labels.clone()); |
| 212 | let copy_to_count = self.copy_to_count.get_delete_on_drop_metric(labels.clone()); |
| 213 | let history_command_count = CommandMetrics::build(|typ| { |
| 214 | let labels = labels.iter().cloned().chain([typ.into()]).collect(); |
| 215 | self.history_command_count.get_delete_on_drop_metric(labels) |
| 216 | }); |
| 217 | let history_dataflow_count = self |
| 218 | .history_dataflow_count |
| 219 | .get_delete_on_drop_metric(labels.clone()); |
| 220 | let peeks_total = PeekMetrics::build(|typ| { |
| 221 | let labels = labels.iter().cloned().chain([typ.into()]).collect(); |
| 222 | self.peeks_total.get_delete_on_drop_metric(labels) |
| 223 | }); |
| 224 | let peek_duration_seconds = PeekMetrics::build(|typ| { |
| 225 | let labels = labels.iter().cloned().chain([typ.into()]).collect(); |
| 226 | self.peek_duration_seconds.get_delete_on_drop_metric(labels) |
| 227 | }); |
| 228 | let response_send_count = self |
| 229 | .response_send_count |
| 230 | .get_delete_on_drop_metric(labels.clone()); |
| 231 | let response_recv_count = self |
| 232 | .response_recv_count |
| 233 | .get_delete_on_drop_metric(labels.clone()); |
| 234 | let connected_replica_count = self |
| 235 | .connected_replica_count |
| 236 | .get_delete_on_drop_metric(labels); |
| 237 | |
| 238 | InstanceMetrics { |
| 239 | instance_id, |
| 240 | metrics: self.clone(), |
| 241 | replica_count, |
| 242 | collection_count, |
| 243 | collection_unscheduled_count, |
| 244 | copy_to_count, |
| 245 | peek_count, |
| 246 | subscribe_count, |
| 247 | history_command_count, |
| 248 | history_dataflow_count, |
| 249 | peeks_total, |
| 250 | peek_duration_seconds, |
| 251 | response_send_count, |
| 252 | response_recv_count, |
| 253 | connected_replica_count, |
| 254 | } |
| 255 | } |
| 256 | } |
no test coverage detected