In the current implementation of the View constructor in metrics, both AggregationType and AggregationConfig are supplied by the user, which introduces a potential mismatch—for example, passing the base AggregationConfig when the type is kHistogram. Such inconsistency leads to unsafe type casting, as the system attempts to reinterpret the base configuration as a derived one, resulting in undefined behavior and possible server-side memory access violations.
View view("view_name", "description", AggregationType::kDefault, aggregation_config);