kbendick commented on a change in pull request #4050: URL: https://github.com/apache/iceberg/pull/4050#discussion_r800114575
########## File path: api/src/main/java/org/apache/iceberg/io/FileIOMetrics.java ########## @@ -0,0 +1,58 @@ +/* + * 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. + */ +package org.apache.iceberg.io; + +import java.io.Serializable; +import java.util.Map; + +/** + * Optional interface for FileIO implementations to report metrics related + * to read/write operations. + */ +public interface FileIOMetrics extends Serializable { + void initialize(Map<String,String> properties); + void incrementBytesRead(long bytesRead); Review comment: I strongly agree that we should be thinking more high level, with `Counter` types that can operate on metrics with a label set (like increment(s3ResdRequestCounts). A good example of this is Prometheus, which has counters / gauges / histograms with arbitrary labels. So we could count something like S3 request with dimensions of request type (PUT, DELETE, etc) and possibly even more dimensions like bucket. One decent example in my opinion is Flink’s metric system that allows some of the work to be offloaded to a library (in their case, Dropwizard for histograms). The metrics of the Hadoop FileSystem are not really what users of object storage like s3 are commonly interested in. They want to see S3 request rates and other things that impact their bill. So a more generic way of tracking metrics would be better. Then, engine by engine, we can provide instances / shims for those metrics to report them as is supported. But there are ways to still export the metrics in commonly used formats, like the Prometheus time series metrics format, in many engines (such as Flink - which I’ve done in production using custom metrics so I know it is possible). Given there’s strong reason to believe that we could export our custom metrics in at least one commonly used metrics format (Prometheus for sure - and likely more), in one commonly used engine (Apache Flink) if not more, I’d vote for a higher level abstraction that we then use to implement Hadoop FileSystem metrics as needed. +1 to more generic Counters for tracking more than just what’s supported today by Hadoop’s interfaces. -- 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]
