opentelemetry-cpp icon indicating copy to clipboard operation
opentelemetry-cpp copied to clipboard

[Code health] include-what-you-use cleanup, part 2

Open marcalff opened this issue 1 year ago • 1 comments

Contributes to #2054

Changes

Changed the include-what-you-use build to:

  • use the C++14 STL
  • cover more code

Performed general cleanup to resolve issues reported by include-what-you-use:

  • Cleanup in OTLP HTTP exporter
  • Cleanup in OTLP File exporter
  • Cleanup in Zipkin exporter
  • Cleanup in exporter examples

For the most part, applying the code suggestions from include-what-you-use was sufficient.

In some cases, in particular for:

namespace nostd = opentelemetry::nostd;

nostd::xxx foo;

the namespace directive causes iwyu to want a header to declare the nostd namespace itself.

Because there are many available headers, iwyu does not suggest the best choice.

Resolved by removing the namespace alias, and use fully qualified names instead:

opentelemetry::nostd::xxx foo;

This is the second pass at cleanup, follow up work is still required.

For significant contributions please make sure you have completed the following items:

  • [ ] CHANGELOG.md updated for non-trivial changes
  • [ ] Unit tests have been added
  • [X] Changes in public API reviewed

marcalff avatar Jun 17 '24 20:06 marcalff

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 87.67%. Comparing base (497eaf4) to head (3ea1033). Report is 97 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2704      +/-   ##
==========================================
+ Coverage   87.12%   87.67%   +0.56%     
==========================================
  Files         200      190      -10     
  Lines        6109     5855     -254     
==========================================
- Hits         5322     5133     -189     
+ Misses        787      722      -65     
Files Coverage Δ
exporters/ostream/src/span_exporter.cc 87.50% <ø> (-0.61%) :arrow_down:
sdk/src/logs/logger.cc 78.95% <ø> (ø)
sdk/src/logs/logger_provider.cc 90.91% <ø> (ø)
sdk/src/logs/readable_log_record.cc 58.34% <ø> (ø)
sdk/src/metrics/meter.cc 62.14% <ø> (+0.69%) :arrow_up:
sdk/src/metrics/meter_provider.cc 87.18% <ø> (+0.34%) :arrow_up:
sdk/src/metrics/state/observable_registry.cc 83.73% <ø> (+0.39%) :arrow_up:
sdk/src/trace/tracer.cc 82.46% <ø> (ø)
sdk/src/trace/tracer_provider.cc 89.14% <ø> (ø)

... and 109 files with indirect coverage changes

codecov[bot] avatar Jun 17 '24 20:06 codecov[bot]

Marking as blocking, because this PR is likely to cause merge conflicts with the clang-tidy cleanup:

  • #2990

so it is very desirable to get this merged soon.

Also, merging this round (part 2) is required before implementing more include-what-you-use cleanup on more code.

@open-telemetry/cpp-approvers Please review.

marcalff avatar Jul 06 '24 09:07 marcalff