Skip to content

Commit

Permalink
Restore +2 when reserve space for vector.
Browse files Browse the repository at this point in the history
Signed-off-by: owent <[email protected]>
  • Loading branch information
owent committed Oct 3, 2023
1 parent b6ca2f2 commit 0149d5c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion exporters/prometheus/src/exporter_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 0149d5c

Please sign in to comment.