[CODE HEALTH] Move logger_sdk_test classes into anonymous namespace#4124
Merged
lalitb merged 2 commits intoJun 5, 2026
Merged
Conversation
Wraps the 6 file-scope class and struct declarations in sdk/test/logs/logger_sdk_test.cc within an anonymous namespace to give them internal linkage and clear the misc-use-internal-linkage warnings clang-tidy reports on this file. The wrap spans from the first class (MockLogRecordable at line 119) to end of file, covering MockLogRecordable, MockProcessor, EnabledProcessorCallState, EnablementAwareProcessor, CustomLogConfiguratorTestData, and CustomLoggerConfiguratorTestFixture. TEST and TEST_P macros inside the namespace block work correctly with gtest. The pre-existing anonymous namespace at lines 65-99 (wrapping abiv2 helper functions inside an existing #if abiv2 gate) is left in place. The ratchet drop is asymmetric because 2 of the 6 classes (EnabledProcessorCallState and EnablementAwareProcessor) are inside an #if OPENTELEMETRY_ABI_VERSION_NO >= 2 block and only exist in abiv2 builds: * abiv1-preview warning_limit lowered from 356 to 352 (-4 always-on classes) * abiv2-preview warning_limit lowered from 362 to 356 (-4 always-on + -2 abiv2-only classes = -6 total) Part of open-telemetry#2053 Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
1cc54e0 to
86480bc
Compare
marcalff
approved these changes
Jun 5, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4124 +/- ##
==========================================
- Coverage 81.95% 81.94% -0.01%
==========================================
Files 385 385
Lines 16067 16067
==========================================
- Hits 13166 13164 -2
- Misses 2901 2903 +2 🚀 New features to boost your workflow:
|
This was referenced Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wraps the 6 file-scope class and struct declarations in
sdk/test/logs/logger_sdk_test.ccwithin an anonymous namespace,clearing the corresponding
misc-use-internal-linkagewarnings.This is the 5th PR of the misc-use-internal-linkage campaign (#4115,
#4116, #4121, #4122 already merged) and the first with an asymmetric
ratchet drop because 2 of the 6 wrapped classes are inside an
#if OPENTELEMETRY_ABI_VERSION_NO >= 2gate.Changes
sdk/test/logs/logger_sdk_test.cc: insertnamespace {after thefirst
TEST(LoggerSDK, LogToNullProcessor)(ends at line 117) and} // namespaceafter the final#endifof the file-trailing#if OPENTELEMETRY_ABI_VERSION_NO < 2block. Wrap covers:MockLogRecordable(line 119, always-on)MockProcessor(line 241, always-on)EnabledProcessorCallStatestruct (line 276, abiv2-only)EnablementAwareProcessor(line 286, abiv2-only)CustomLogConfiguratorTestData(line 668, always-on)CustomLoggerConfiguratorTestFixtureTEST_P fixture (line 747,always-on)
abiv2 helper functions inside an existing
#if abiv2gate) is leftin place.
.github/workflows/clang-tidy.yaml: abiv1 356 -> 352 (-4),abiv2 362 -> 356 (-6).
CHANGELOG.md: one bullet under [Unreleased].Why the ratchet drop is asymmetric
#if OPENTELEMETRY_ABI_VERSION_NO >= 2at lines 275-338 containsEnabledProcessorCallStateandEnablementAwareProcessor. In abiv1builds the preprocessor strips these out, so clang-tidy never sees
them and they are not counted in the abiv1 baseline of 356. In abiv2
builds they are visible and contribute 2 of the 362 total warnings.
After this PR clears all 6 sites, both ratchets drop by the count
visible in that build (abiv1: -4, abiv2: -6), and 2 of the abiv2-only
classes also stop counting against the abiv2 baseline. Net new limits:
abiv1 352, abiv2 356.
This is mechanically the same wrap as #4115 / #4116 / #4121 / #4122;
the only novelty is that this is the first wrapped file containing an
ABI-gated class.
Test plan
logger_sdk_test: 59/59 ninja steps(
WITH_OTLP_HTTP=OFF -DWITH_OTLP_GRPC=OFF)logger_sdk_test:-DWITH_ABI_VERSION_2=ON -DWITH_ABI_VERSION_1=OFF, 59/59 stepsabiv2-only, exercising
EnabledProcessorCallStateandEnablementAwareProcessor)clang-format --dry-run --Werrorclean on the modified filePart of #2053