11// Copyright The OpenTelemetry Authors
22// SPDX-License-Identifier: Apache-2.0
33
4+ #include < stddef.h>
45#include < stdint.h>
56#include < chrono>
67#include < map>
1112#include < vector>
1213
1314#include " opentelemetry/common/attribute_value.h"
15+ #include " opentelemetry/common/kv_properties.h"
1416#include " opentelemetry/context/propagation/composite_propagator.h"
1517#include " opentelemetry/context/propagation/text_map_propagator.h"
1618#include " opentelemetry/nostd/span.h"
19+ #include " opentelemetry/nostd/string_view.h"
1720#include " opentelemetry/sdk/common/global_log_handler.h"
1821#include " opentelemetry/sdk/configuration/aggregation_configuration.h"
1922#include " opentelemetry/sdk/configuration/aggregation_configuration_visitor.h"
@@ -209,7 +212,10 @@ class AttributeValueSetter
209212 size_t length = model->value .size ();
210213 std::vector<nostd::string_view> string_view_array (length);
211214
212- for (int i = 0 ; i < length; i++)
215+ // We have: std::vector<std::string>
216+ // We need: nostd::span<const nostd::string_view>
217+
218+ for (size_t i = 0 ; i < length; i++)
213219 {
214220 string_view_array[i] = model->value [i];
215221 }
@@ -227,7 +233,10 @@ class AttributeValueSetter
227233 size_t length = model->value .size ();
228234 std::vector<int64_t > int_array (length);
229235
230- for (int i = 0 ; i < length; i++)
236+ // We have: std::vector<size_t>
237+ // We need: nostd::span<const int64_t>
238+
239+ for (size_t i = 0 ; i < length; i++)
231240 {
232241 int_array[i] = model->value [i];
233242 }
@@ -242,15 +251,11 @@ class AttributeValueSetter
242251 const opentelemetry::sdk::configuration::DoubleArrayAttributeValueConfiguration *model)
243252 override
244253 {
245- size_t length = model->value .size ();
246- std::vector<double > double_array (length);
254+ // We have: std::vector<double>
255+ // We need: nostd::span<const double>
256+ // so no data conversion needed
247257
248- for (int i = 0 ; i < length; i++)
249- {
250- double_array[i] = model->value [i];
251- }
252-
253- nostd::span<const double > span (double_array.data (), double_array.size ());
258+ nostd::span<const double > span (model->value .data (), model->value .size ());
254259
255260 opentelemetry::common::AttributeValue attribute_value (span);
256261 resource_attributes_.SetAttribute (name_, attribute_value);
@@ -266,6 +271,9 @@ class AttributeValueSetter
266271 // it has no data() to convert it to a span
267272 std::unique_ptr<bool []> bool_array (new bool [length]);
268273
274+ // We have: std::vector<bool>
275+ // We need: nostd::span<const bool>
276+
269277 for (int i = 0 ; i < length; i++)
270278 {
271279 bool_array[i] = model->value [i];
0 commit comments