evindj commented on code in PR #589: URL: https://github.com/apache/iceberg-cpp/pull/589#discussion_r3102568875
########## src/iceberg/metrics/metrics_reporters.cc: ########## @@ -0,0 +1,151 @@ +/* + * 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. + */ + +#include "iceberg/metrics/metrics_reporters.h" + +#include <iostream> +#include <unordered_set> + +#include "iceberg/util/string_util.h" + +namespace iceberg { + +namespace { + +/// \brief Registry type for MetricsReporter factories. +using MetricsReporterRegistry = std::unordered_map<std::string, MetricsReporterFactory>; + +/// \brief Get the set of known built-in metrics reporter types. +const std::unordered_set<std::string>& DefaultReporterTypes() { + static const std::unordered_set<std::string> kReporterTypes = { + std::string(kMetricsReporterTypeNoop), + }; + return kReporterTypes; +} + +/// \brief Infer the reporter type from properties. +std::string InferReporterType( + const std::unordered_map<std::string, std::string>& properties) { + auto it = properties.find(std::string(kMetricsReporterImpl)); Review Comment: > while Java and the Iceberg docs treat the same property as a fully qualified class name whose instance is initialized with catalog properties the divergence is because c++ does not support reflection. I decided on making things local case to reduce the risk of typos based on caps on/off. > typo quietly disables metrics instead of surfacing a configuration error I will update to surface a configuration error. -- 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]
