open-telemetry / opentelemetry-cpp

The OpenTelemetry C++ Client
https://opentelemetry.io/
Apache License 2.0
811 stars 391 forks source link

[Code health] include-what-you-use cleanup #2692

Closed marcalff closed 2 weeks ago

marcalff commented 3 weeks ago

Contributes to #2054

Changes

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

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;

Note that further cleanup is required, for code build optionally (various exporters, unit tests, etc).

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

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 70.96774% with 9 lines in your changes missing coverage. Please review.

Project coverage is 87.67%. Comparing base (497eaf4) to head (64e0b07). Report is 81 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692/graphs/tree.svg?width=650&height=150&src=pr&token=FJESTYQ2AD&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) ```diff @@ Coverage Diff @@ ## main #2692 +/- ## ========================================== + Coverage 87.12% 87.67% +0.55% ========================================== Files 200 190 -10 Lines 6109 5853 -256 ========================================== - Hits 5322 5131 -191 + Misses 787 722 -65 ``` | [Files](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [api/include/opentelemetry/nostd/utility.h](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692?src=pr&el=tree&filepath=api%2Finclude%2Fopentelemetry%2Fnostd%2Futility.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-YXBpL2luY2x1ZGUvb3BlbnRlbGVtZXRyeS9ub3N0ZC91dGlsaXR5Lmg=) | `83.34% <ø> (ø)` | | | [...de/opentelemetry/plugin/detail/dynamic\_load\_unix.h](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692?src=pr&el=tree&filepath=api%2Finclude%2Fopentelemetry%2Fplugin%2Fdetail%2Fdynamic_load_unix.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-YXBpL2luY2x1ZGUvb3BlbnRlbGVtZXRyeS9wbHVnaW4vZGV0YWlsL2R5bmFtaWNfbG9hZF91bml4Lmg=) | `24.00% <ø> (ø)` | | | [api/include/opentelemetry/plugin/factory.h](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692?src=pr&el=tree&filepath=api%2Finclude%2Fopentelemetry%2Fplugin%2Ffactory.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-YXBpL2luY2x1ZGUvb3BlbnRlbGVtZXRyeS9wbHVnaW4vZmFjdG9yeS5o) | `0.00% <ø> (ø)` | | | [...de/opentelemetry/exporters/ostream/span\_exporter.h](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692?src=pr&el=tree&filepath=exporters%2Fostream%2Finclude%2Fopentelemetry%2Fexporters%2Fostream%2Fspan_exporter.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-ZXhwb3J0ZXJzL29zdHJlYW0vaW5jbHVkZS9vcGVudGVsZW1ldHJ5L2V4cG9ydGVycy9vc3RyZWFtL3NwYW5fZXhwb3J0ZXIuaA==) | `100.00% <ø> (ø)` | | | [exporters/ostream/src/log\_record\_exporter.cc](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692?src=pr&el=tree&filepath=exporters%2Fostream%2Fsrc%2Flog_record_exporter.cc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-ZXhwb3J0ZXJzL29zdHJlYW0vc3JjL2xvZ19yZWNvcmRfZXhwb3J0ZXIuY2M=) | `97.06% <ø> (-0.08%)` | :arrow_down: | | [...porters/ostream/src/log\_record\_exporter\_factory.cc](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692?src=pr&el=tree&filepath=exporters%2Fostream%2Fsrc%2Flog_record_exporter_factory.cc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-ZXhwb3J0ZXJzL29zdHJlYW0vc3JjL2xvZ19yZWNvcmRfZXhwb3J0ZXJfZmFjdG9yeS5jYw==) | `100.00% <ø> (ø)` | | | [exporters/ostream/src/metric\_exporter.cc](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692?src=pr&el=tree&filepath=exporters%2Fostream%2Fsrc%2Fmetric_exporter.cc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-ZXhwb3J0ZXJzL29zdHJlYW0vc3JjL21ldHJpY19leHBvcnRlci5jYw==) | `90.91% <ø> (-0.89%)` | :arrow_down: | | [exporters/ostream/src/span\_exporter.cc](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692?src=pr&el=tree&filepath=exporters%2Fostream%2Fsrc%2Fspan_exporter.cc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-ZXhwb3J0ZXJzL29zdHJlYW0vc3JjL3NwYW5fZXhwb3J0ZXIuY2M=) | `87.50% <ø> (-0.61%)` | :arrow_down: | | [...pentelemetry/sdk/logs/batch\_log\_record\_processor.h](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692?src=pr&el=tree&filepath=sdk%2Finclude%2Fopentelemetry%2Fsdk%2Flogs%2Fbatch_log_record_processor.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c2RrL2luY2x1ZGUvb3BlbnRlbGVtZXRyeS9zZGsvbG9ncy9iYXRjaF9sb2dfcmVjb3JkX3Byb2Nlc3Nvci5o) | `100.00% <ø> (ø)` | | | [...ry/sdk/metrics/aggregation/histogram\_aggregation.h](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692?src=pr&el=tree&filepath=sdk%2Finclude%2Fopentelemetry%2Fsdk%2Fmetrics%2Faggregation%2Fhistogram_aggregation.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c2RrL2luY2x1ZGUvb3BlbnRlbGVtZXRyeS9zZGsvbWV0cmljcy9hZ2dyZWdhdGlvbi9oaXN0b2dyYW1fYWdncmVnYXRpb24uaA==) | `90.48% <ø> (-0.82%)` | :arrow_down: | | ... and [36 more](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | | ... and [76 files with indirect coverage changes](https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/pull/2692/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)