tanmayrauth commented on code in PR #1343: URL: https://github.com/apache/iceberg-go/pull/1343#discussion_r3494555439
########## metrics/reporter.go: ########## @@ -0,0 +1,54 @@ +// 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 metrics implements Iceberg's Metrics Reporting API for iceberg-go. +// +// A [Reporter] is a pluggable sink that receives a [Report] — a ScanReport +// after scan planning or a CommitReport after a commit — describing what the +// client did (files and manifests considered, scanned and skipped; bytes read; +// commit attempts and durations). Reporting gives operators a standard way to +// aggregate these otherwise-invisible client-side metrics across many clients. +// +// Reporting is strictly opt-in: with no reporter configured the instrumented +// code paths do no work. Reporters must never block or fail the scan/commit +// they observe — see [Reporter] for the contract. +// +// This package provides the contract and the built-in reporters ([Nop], +// [LoggingReporter], [InMemoryReporter], and [Combine]). The concrete report +// types and the scan/commit instrumentation are layered on top in later work. +package metrics + +import "context" + +// Report is the sealed marker interface implemented by the concrete report +// types (ScanReport and CommitReport). It is sealed to this package so the set +// of report types stays under the framework's control. +type Report interface { Review Comment: Renamed the marker interface to MetricsReport and kept Reporter.Report(ctx, MetricsReport) as the verb, so signatures now read Report(context.Context, MetricsReport) with no type/method collision. This also lines the Go API up with Java/PyIceberg's MetricsReport, which should ease the ScanReport/CommitReport ports in the later phases. -- 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]
