Skip to content

Commit 8511e80

Browse files
committed
Address test comment & fix IWYU warnings
1 parent 5efb9dd commit 8511e80

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

sdk/test/trace/tracer_config_test.cc

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "opentelemetry/sdk/trace/tracer_config.h"
55
#include <gtest/gtest.h>
66
#include <array>
7-
#include <type_traits>
7+
#include <string>
88
#include <utility>
99
#include <vector>
1010
#include "opentelemetry/common/attribute_value.h"
@@ -38,33 +38,40 @@ TEST(TracerConfig, CheckDefaultConfigWorksAccToSpec)
3838

3939
/** Tests to verify the behavior of trace_sdk::TracerConfig::DefaultConfigurator */
4040

41-
std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue> attr1 = {
41+
static std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue> attr1 = {
4242
"accept_single_attr", true};
43-
std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue> attr2 = {
43+
static std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue> attr2 = {
4444
"accept_second_attr", "some other attr"};
45-
std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue> attr3 = {
45+
static std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue> attr3 = {
4646
"accept_third_attr", 3};
4747

48-
const std::array<instrumentation_scope::InstrumentationScope *, 5> instrumentation_scopes = {
49-
std::move(instrumentation_scope::InstrumentationScope::Create("test_scope_1")).get(),
50-
std::move(instrumentation_scope::InstrumentationScope::Create("test_scope_2", "1.0")).get(),
48+
static instrumentation_scope::InstrumentationScope *test_scope_1 =
49+
std::move(instrumentation_scope::InstrumentationScope::Create("test_scope_1")).get();
50+
static instrumentation_scope::InstrumentationScope *test_scope_2 =
51+
std::move(instrumentation_scope::InstrumentationScope::Create("test_scope_2", "1.0")).get();
52+
static instrumentation_scope::InstrumentationScope *test_scope_3 =
5153
std::move(instrumentation_scope::InstrumentationScope::Create(
5254
"test_scope_3",
5355
"0",
5456
"https://opentelemetry.io/schemas/v1.18.0"))
55-
.get(),
57+
.get();
58+
static instrumentation_scope::InstrumentationScope *test_scope_4 =
5659
std::move(instrumentation_scope::InstrumentationScope::Create(
57-
"test_scope_3",
60+
"test_scope_4",
5861
"0",
5962
"https://opentelemetry.io/schemas/v1.18.0",
6063
{attr1}))
61-
.get(),
64+
.get();
65+
static instrumentation_scope::InstrumentationScope *test_scope_5 =
6266
std::move(instrumentation_scope::InstrumentationScope::Create(
63-
"test_scope_4",
67+
"test_scope_5",
6468
"0",
6569
"https://opentelemetry.io/schemas/v1.18.0",
6670
{attr1, attr2, attr3}))
67-
.get(),
71+
.get();
72+
73+
const std::array<instrumentation_scope::InstrumentationScope *, 5> instrumentation_scopes = {
74+
test_scope_1, test_scope_2, test_scope_3, test_scope_4, test_scope_5,
6875
};
6976

7077
// Test fixture for VerifyDefaultConfiguratorBehavior

sdk/test/trace/tracer_test.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <algorithm>
77
#include <chrono>
88
#include <cstdint>
9+
#include <functional>
910
#include <initializer_list>
1011
#include <map>
1112
#include <string>

0 commit comments

Comments
 (0)