Skip to content

Conversation

owent
Copy link
Member

@owent owent commented Aug 30, 2025

Fixes #3618

Changes

  • Cleanup cppcheck warnings

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

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

@Copilot Copilot AI review requested due to automatic review settings August 30, 2025 08:46
@owent owent requested a review from a team as a code owner August 30, 2025 08:46
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses cppcheck warnings by refactoring destructors to avoid virtual function calls during object destruction. The main change introduces Internal* methods that perform the actual work, allowing destructors to call non-virtual methods while preserving the existing public API.

  • Introduces Internal* methods for shutdown operations across multiple processor classes
  • Refactors destructors to call internal methods instead of virtual functions
  • Updates CI configuration to fail builds on any cppcheck warnings

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
sdk/src/trace/batch_span_processor.cc Refactors shutdown logic with InternalShutdown method
sdk/src/logs/multi_log_record_processor.cc Adds internal methods for ForceFlush and Shutdown operations
sdk/src/logs/batch_log_record_processor.cc Implements InternalShutdown method pattern
sdk/include/opentelemetry/sdk/trace/simple_processor.h Moves destructor and adds InternalShutdown method
sdk/include/opentelemetry/sdk/trace/multi_span_processor.h Refactors destructor to use InternalShutdown
sdk/include/opentelemetry/sdk/trace/batch_span_processor.h Adds InternalShutdown method declaration and documentation
sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h Declares internal methods with updated documentation
sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h Adds InternalShutdown method declaration
sdk/include/opentelemetry/sdk/common/circular_buffer.h Fixes variable declaration for cppcheck warning
ext/src/http/client/curl/http_client_curl.cc Refactors CancelAllSessions with internal implementation
ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h Declares InternalCancelAllSessions method
.github/workflows/cppcheck.yml Updates CI to fail on any cppcheck warnings and fixes formatting

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +112 to +113
* Shuts down the processor and does any cleanup required. Completely drains the buffer/queue of
* all its logs and passes them to the exporter.
Copy link
Preview

Copilot AI Aug 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The InternalShutdown method documentation is incomplete. It should include @param timeout and @return documentation to match the method signature, similar to the public Shutdown method documentation.

Suggested change
* Shuts down the processor and does any cleanup required. Completely drains the buffer/queue of
* all its logs and passes them to the exporter.
* all its logs and passes them to the exporter.
*
* @param timeout The maximum time to wait for shutdown to complete.
* @return true if the shutdown completed successfully within the timeout, false otherwise.

Copilot uses AI. Check for mistakes.

Copy link

codecov bot commented Aug 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.03%. Comparing base (cbfbb02) to head (4387072).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3619      +/-   ##
==========================================
- Coverage   90.06%   90.03%   -0.02%     
==========================================
  Files         220      220              
  Lines        7069     7081      +12     
==========================================
+ Hits         6366     6375       +9     
- Misses        703      706       +3     
Files with missing lines Coverage Δ
...include/opentelemetry/sdk/common/circular_buffer.h 98.15% <100.00%> (ø)
...pentelemetry/sdk/logs/batch_log_record_processor.h 100.00% <ø> (ø)
...ude/opentelemetry/sdk/trace/batch_span_processor.h 100.00% <ø> (ø)
...ude/opentelemetry/sdk/trace/multi_span_processor.h 100.00% <100.00%> (ø)
...include/opentelemetry/sdk/trace/simple_processor.h 100.00% <100.00%> (ø)
sdk/src/logs/batch_log_record_processor.cc 83.34% <100.00%> (+0.22%) ⬆️
sdk/src/logs/multi_log_record_processor.cc 90.63% <100.00%> (+0.63%) ⬆️
sdk/src/trace/batch_span_processor.cc 96.00% <100.00%> (+0.06%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the cleanup.

@marcalff marcalff changed the title Cleanup cppcheck warnings [BUILD] Cleanup cppcheck warnings Aug 30, 2025
Copy link

linux-foundation-easycla bot commented Sep 2, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@owent
Copy link
Member Author

owent commented Sep 2, 2025

CLA Not Signed

  • ✅login: owent / name: owent / (84e625b)
  • ✅login: owent / name: WenTao Ou / (5f72411)
  • ❌ login: @copilot / name: Copilot / The commit (5f72411). This user is authorized, but they must confirm their affiliation with their company. Start the authorization process by clicking here, click "Corporate", select the appropriate company from the list, then confirm your affiliation on the page that appears. For further assistance with EasyCLA, please submit a support request ticket.

CLA Not Signed

  • ✅login: owent / name: owent / (84e625b)
  • ✅login: owent / name: WenTao Ou / (5f72411)
  • ❌ login: @copilot / name: Copilot / The commit (5f72411). This user is authorized, but they must confirm their affiliation with their company. Start the authorization process by clicking here, click "Corporate", select the appropriate company from the list, then confirm your affiliation on the page that appears. For further assistance with EasyCLA, please submit a support request ticket.

The CLA problem is for copilot, anyway to ignore it?

@lalitb
Copy link
Member

lalitb commented Sep 2, 2025

CLA Not Signed

  • ✅login: owent / name: owent / (84e625b)
  • ✅login: owent / name: WenTao Ou / (5f72411)
  • ❌ login: @copilot / name: Copilot / The commit (5f72411). This user is authorized, but they must confirm their affiliation with their company. Start the authorization process by clicking here, click "Corporate", select the appropriate company from the list, then confirm your affiliation on the page that appears. For further assistance with EasyCLA, please submit a support request ticket.

CLA Not Signed

  • ✅login: owent / name: owent / (84e625b)
  • ✅login: owent / name: WenTao Ou / (5f72411)
  • ❌ login: @copilot / name: Copilot / The commit (5f72411). This user is authorized, but they must confirm their affiliation with their company. Start the authorization process by clicking here, click "Corporate", select the appropriate company from the list, then confirm your affiliation on the page that appears. For further assistance with EasyCLA, please submit a support request ticket.

The CLA problem is for copilot, anyway to ignore it?

@owent - This shouldn't happen. for now, can you stash/rebase all the commits in this PR - so that commit is ONLY authored by you ?

@ThomsonTan
Copy link
Contributor

CLA Not Signed

  • ✅login: owent / name: owent / (84e625b)
  • ✅login: owent / name: WenTao Ou / (5f72411)
  • ❌ login: @copilot / name: Copilot / The commit (5f72411). This user is authorized, but they must confirm their affiliation with their company. Start the authorization process by clicking here, click "Corporate", select the appropriate company from the list, then confirm your affiliation on the page that appears. For further assistance with EasyCLA, please submit a support request ticket.

CLA Not Signed

  • ✅login: owent / name: owent / (84e625b)
  • ✅login: owent / name: WenTao Ou / (5f72411)
  • ❌ login: @copilot / name: Copilot / The commit (5f72411). This user is authorized, but they must confirm their affiliation with their company. Start the authorization process by clicking here, click "Corporate", select the appropriate company from the list, then confirm your affiliation on the page that appears. For further assistance with EasyCLA, please submit a support request ticket.

The CLA problem is for copilot, anyway to ignore it?

@owent - This shouldn't happen. for now, can you stash/rebase all the commits in this PR - so that commit is ONLY authored by you ?

Seems suggestion from Copiot should be be applied directly, as it is authored by copilot.

@marcalff
Copy link
Member

marcalff commented Sep 3, 2025

/easycla

@owent owent force-pushed the cleanup_cppcheck_warnings branch 2 times, most recently from fb163bb to 58a4637 Compare September 4, 2025 02:45
@owent owent force-pushed the cleanup_cppcheck_warnings branch from 58a4637 to 4387072 Compare September 4, 2025 02:45
@owent
Copy link
Member Author

owent commented Sep 4, 2025

OK, rebase to remove copilot information now.

@marcalff marcalff merged commit b00958b into open-telemetry:main Sep 4, 2025
66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cleanup cppcheck warnings
4 participants