diff --git a/exporters/prometheus/src/exporter_utils.cc b/exporters/prometheus/src/exporter_utils.cc index 49ece800a5..42fafc6336 100644 --- a/exporters/prometheus/src/exporter_utils.cc +++ b/exporters/prometheus/src/exporter_utils.cc @@ -381,7 +381,7 @@ void PrometheusExporterUtils::SetMetricBasic( // Note that attribute keys are sorted, but sanitized keys can be out-of-order. // We could sort the sanitized keys again, but this seems too expensive to do // in this hot code path. Instead, we ignore out-of-order keys and emit a warning. - metric.label.reserve(labels.size()); + metric.label.reserve(labels.size() + 2); std::string previous_key; for (auto const &label : labels) {