Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/clang-tidy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
matrix:
include:
- cmake_options: all-options-abiv1-preview
warning_limit: 151
warning_limit: 142
- cmake_options: all-options-abiv2-preview
warning_limit: 161
warning_limit: 152
env:
CC: /usr/bin/clang-22
CXX: /usr/bin/clang++-22
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Increment the:

## [Unreleased]

* [CODE HEALTH] Move SDK trace and metrics test helpers into anonymous
namespaces
[#4303](https://github.com/open-telemetry/opentelemetry-cpp/pull/4303)

* [CODE HEALTH] Move metrics storage test fixtures into anonymous namespace
[#4286](https://github.com/open-telemetry/opentelemetry-cpp/pull/4286)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ namespace sdk
{
namespace metrics
{
namespace
{

class AlignedHistogramBucketExemplarReservoirTestPeer : public ::testing::Test
{
public:
Expand Down Expand Up @@ -59,6 +62,8 @@ TEST_F(AlignedHistogramBucketExemplarReservoirTestPeer, OfferMeasurementWithNonE
ASSERT_TRUE(!exemplar_data.empty());
}

} // namespace

} // namespace metrics
} // namespace sdk
OPENTELEMETRY_END_NAMESPACE
Expand Down
6 changes: 3 additions & 3 deletions sdk/test/metrics/measurements_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ using namespace opentelemetry::sdk::instrumentationscope;
using namespace opentelemetry::sdk::metrics;
using namespace opentelemetry::sdk::common;

namespace
{

class MockMetricExporter : public MetricReader
{
public:
Expand All @@ -54,9 +57,6 @@ class MockMetricExporter : public MetricReader
void OnInitialized() noexcept override {}
};

namespace
{

size_t GetBenchmarkThreads()
{
const char *env = std::getenv("BENCHMARK_THREADS");
Expand Down
5 changes: 5 additions & 0 deletions sdk/test/trace/batch_span_processor_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ using opentelemetry::sdk::common::unsetenv;

OPENTELEMETRY_BEGIN_NAMESPACE

namespace
{

/**
* Returns a mock span exporter meant exclusively for testing only
*/
Expand Down Expand Up @@ -499,4 +502,6 @@ TEST(BatchSpanProcessorOptionsEnvTest, TestDesignatedInitializers)
}
#endif

} // namespace

OPENTELEMETRY_END_NAMESPACE
5 changes: 5 additions & 0 deletions sdk/test/trace/tracer_provider_set_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ namespace nostd = opentelemetry::nostd;
namespace trace_api = opentelemetry::trace;
namespace trace_sdk = opentelemetry::sdk::trace;

namespace
{

class TestProvider : public TracerProvider
{
public:
Expand Down Expand Up @@ -80,3 +83,5 @@ TEST(Provider, SetTracerProviderDisabled)
unsetenv("OTEL_SDK_DISABLED");
}
#endif

} // namespace
5 changes: 3 additions & 2 deletions sdk/test/trace/tracer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ using opentelemetry::exporter::memory::InMemorySpanData;
using opentelemetry::exporter::memory::InMemorySpanExporter;
using opentelemetry::trace::SpanContext;

namespace
{

/**
* A mock sampler with ShouldSample returning:
* Decision::RECORD_AND_SAMPLE if trace_id is valid
Expand Down Expand Up @@ -171,8 +174,6 @@ class MockIdGenerator : public IdGenerator
uint8_t buf_trace[16] = {1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1};
};

namespace
{
std::shared_ptr<opentelemetry::trace::Tracer> initTracer(std::unique_ptr<SpanExporter> &&exporter)
{
auto processor = std::unique_ptr<SpanProcessor>(new SimpleSpanProcessor(std::move(exporter)));
Expand Down
Loading