in fb303/detail/QuantileStatMap-inl.h [255:287]
double extractValueImpl(
const StatDef& statDef,
const folly::QuantileEstimates& estimate,
std::chrono::seconds duration) {
switch (statDef.type) {
case ExportType::PERCENT:
for (const auto& pr : estimate.quantiles) {
if (pr.first == statDef.quantile) {
return pr.second;
}
}
LOG(FATAL) << "Requested missing quantile: " << statDef.quantile;
case ExportType::SUM:
return estimate.sum;
case ExportType::COUNT:
return estimate.count;
case ExportType::AVG:
if (estimate.count > 0) {
return estimate.sum / estimate.count;
}
return 0;
case ExportType::RATE:
if (duration.count() > 0) {
const auto& numerator = FLAGS_fb303_qstat_legacy_use_count_for_rate
? estimate.count
: estimate.sum;
return numerator / duration.count();
}
return estimate.count;
}
LOG(FATAL) << "Unknown export type: " << statDef.type;
return 0;
}