DerGut commented on code in PR #3709: URL: https://github.com/apache/iceberg-rust/pull/3709#discussion_r4644268253
########## crates/iceberg/src/metrics.rs: ########## @@ -0,0 +1,212 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +//! Metrics reporting API for Iceberg table operations. + +use std::collections::HashMap; +use std::fmt::Debug; +use std::time::Duration; + +use async_trait::async_trait; + +use crate::TableIdent; +use crate::expr::Predicate; +use crate::spec::SchemaId; + +/// Receives metrics reports for completed table operations. +/// +/// Implementations must handle reporting failures internally so they do not affect the operation +/// that produced the report. +#[async_trait] +pub trait MetricsReporter: Debug + Send + Sync { + /// Reports the metrics for a completed table operation. + async fn report(&self, report: &MetricsReport); +} + +/// A metrics report for an Iceberg table operation. +#[derive(Debug)] +#[non_exhaustive] +pub enum MetricsReport { + /// A report produced by planning a table scan. + Scan(ScanReport), +} + +/// Information and metrics collected while planning a table scan. +#[derive(Debug)] +pub struct ScanReport { + pub(crate) table_ident: TableIdent, Review Comment: There's no technical reason, I only feel like a typed/ named thing is usually more descriptive and flexible than a plain string. We can easily derive the name from it and its a tad harder to assign a wrong value 🤷 But nothing I have a strong opinion about if you prefer to be consistent with Java. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
