Skip to content

Commit b382755

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

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

sdk/test/trace/tracer_config_test.cc

+19-11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "opentelemetry/sdk/trace/tracer_config.h"
55
#include <gtest/gtest.h>
66
#include <array>
7+
#include <string>
78
#include <type_traits>
89
#include <utility>
910
#include <vector>
@@ -38,33 +39,40 @@ TEST(TracerConfig, CheckDefaultConfigWorksAccToSpec)
3839

3940
/** Tests to verify the behavior of trace_sdk::TracerConfig::DefaultConfigurator */
4041

41-
std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue> attr1 = {
42+
static std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue> attr1 = {
4243
"accept_single_attr", true};
43-
std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue> attr2 = {
44+
static std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue> attr2 = {
4445
"accept_second_attr", "some other attr"};
45-
std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue> attr3 = {
46+
static std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue> attr3 = {
4647
"accept_third_attr", 3};
4748

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(),
49+
static instrumentation_scope::InstrumentationScope *test_scope_1 =
50+
std::move(instrumentation_scope::InstrumentationScope::Create("test_scope_1")).get();
51+
static instrumentation_scope::InstrumentationScope *test_scope_2 =
52+
std::move(instrumentation_scope::InstrumentationScope::Create("test_scope_2", "1.0")).get();
53+
static instrumentation_scope::InstrumentationScope *test_scope_3 =
5154
std::move(instrumentation_scope::InstrumentationScope::Create(
5255
"test_scope_3",
5356
"0",
5457
"https://opentelemetry.io/schemas/v1.18.0"))
55-
.get(),
58+
.get();
59+
static instrumentation_scope::InstrumentationScope *test_scope_4 =
5660
std::move(instrumentation_scope::InstrumentationScope::Create(
57-
"test_scope_3",
61+
"test_scope_4",
5862
"0",
5963
"https://opentelemetry.io/schemas/v1.18.0",
6064
{attr1}))
61-
.get(),
65+
.get();
66+
static instrumentation_scope::InstrumentationScope *test_scope_5 =
6267
std::move(instrumentation_scope::InstrumentationScope::Create(
63-
"test_scope_4",
68+
"test_scope_5",
6469
"0",
6570
"https://opentelemetry.io/schemas/v1.18.0",
6671
{attr1, attr2, attr3}))
67-
.get(),
72+
.get();
73+
74+
const std::array<instrumentation_scope::InstrumentationScope *, 5> instrumentation_scopes = {
75+
test_scope_1, test_scope_2, test_scope_3, test_scope_4, test_scope_5,
6876
};
6977

7078
// Test fixture for VerifyDefaultConfiguratorBehavior

sdk/test/trace/tracer_test.cc

+1
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)