Skip to content

Commit e692852

Browse files
committed
build warnings cleanup
1 parent 30df255 commit e692852

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

sdk/src/configuration/configured_sdk.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <utility>
88

99
#include "opentelemetry/context/propagation/global_propagator.h"
10+
#include "opentelemetry/context/propagation/text_map_propagator.h"
1011
#include "opentelemetry/logs/logger_provider.h"
1112
#include "opentelemetry/logs/provider.h"
1213
#include "opentelemetry/metrics/meter_provider.h"

sdk/src/configuration/sdk_builder.cc

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
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>
@@ -11,9 +12,11 @@
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

Comments
 (0)