Skip to content

[#noissue] Cleanup#12475

Merged
emeroad merged 1 commit intopinpoint-apm:masterfrom
emeroad:#noissue_cleanup1
May 23, 2025
Merged

[#noissue] Cleanup#12475
emeroad merged 1 commit intopinpoint-apm:masterfrom
emeroad:#noissue_cleanup1

Conversation

@emeroad
Copy link
Copy Markdown
Member

@emeroad emeroad commented May 23, 2025

This pull request focuses on improving code efficiency, readability, and logging throughout the web module. The most significant changes include optimizing the initialization of collections, enhancing logging for debugging, and improving consistency in method return types.

Code efficiency improvements:

  • Updated the initialization of ArrayList instances to include initial capacity where applicable, improving memory allocation efficiency in CallTreeIterator, Node, and MetaSpanCallTreeFactory. ([[1]](https://github.com/pinpoint-apm/pinpoint/pull/12475/files#diff-eb3a3e58cc17eeca043134aebe7207eee60f725b5e5d6d30cf189304e0672e39L248-R248), [[2]](https://github.com/pinpoint-apm/pinpoint/pull/12475/files#diff-90618b20ad38a7a731382592e26581870901eda13a5e43700a62d148c712502bL141-R141), [[3]](https://github.com/pinpoint-apm/pinpoint/pull/12475/files#diff-7fc61eafdca60bd93e071196758b677a2102b10cb460bb11abcf02e003c332afL52-R59), [[4]](https://github.com/pinpoint-apm/pinpoint/pull/12475/files#diff-7fc61eafdca60bd93e071196758b677a2102b10cb460bb11abcf02e003c332afL77-R86))
  • Simplified the instantiation of ArrayList by removing redundant type arguments in ProxyRequestTypeRegistryServiceImpl. ([web/src/main/java/com/navercorp/pinpoint/web/service/ProxyRequestTypeRegistryServiceImpl.javaL78-R78](https://github.com/pinpoint-apm/pinpoint/pull/12475/files#diff-bdc7a6f08ff84d6c2b1f1e6772a35b065cdb71bf23ad9b916234d41780291e0aL78-R78))

Method return type consistency:

  • Changed the return type of getUnpopulatedEmulatedNodes from List to Collection in VirtualLinkHandler to better reflect the method's implementation and usage. ([[1]](https://github.com/pinpoint-apm/pinpoint/pull/12475/files#diff-a7126b4b2e85315a3bad368e2fdf2a44e7d859984c3ef004816fd3da987426c2L62-R62), [[2]](https://github.com/pinpoint-apm/pinpoint/pull/12475/files#diff-a7126b4b2e85315a3bad368e2fdf2a44e7d859984c3ef004816fd3da987426c2L78-R86))

Logging enhancements:

  • Added conditional checks for logger.isTraceEnabled() before trace-level logging in VirtualLinkHandler to avoid unnecessary string concatenation when trace logging is disabled. ([web/src/main/java/com/navercorp/pinpoint/web/applicationmap/map/VirtualLinkHandler.javaR98-R107](https://github.com/pinpoint-apm/pinpoint/pull/12475/files#diff-a7126b4b2e85315a3bad368e2fdf2a44e7d859984c3ef004816fd3da987426c2R98-R107))

@emeroad emeroad added this to the 3.1.0 milestone May 23, 2025
@emeroad emeroad requested a review from Copilot May 23, 2025 07:39
Copy link
Copy Markdown

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 applies various cleanups across the web module, focusing on modernizing generics usage, optimizing collection allocations, refining annotation list setup, and improving logging and return-type consistency.

  • Replace explicit generic types with the diamond operator
  • Pre-size ArrayList instances to match expected element counts
  • Refactor annotation-list initialization for clarity
  • Add isTraceEnabled guard around trace logging and broaden return type to Collection

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
web/src/main/java/com/navercorp/pinpoint/web/service/ProxyRequestTypeRegistryServiceImpl.java Use diamond operator for ArrayList instantiation
web/src/main/java/com/navercorp/pinpoint/web/calltree/span/Node.java Pre-size alignList based on spanEventBoList.size()
web/src/main/java/com/navercorp/pinpoint/web/calltree/span/MetaSpanCallTreeFactory.java Consolidate annotations list creation in unknown and corrupted methods
web/src/main/java/com/navercorp/pinpoint/web/calltree/span/CallTreeIterator.java Pre-size values list using nodes.size()
web/src/main/java/com/navercorp/pinpoint/web/applicationmap/map/VirtualLinkHandler.java Change helper return type to Collection and guard logger.trace calls

@emeroad emeroad force-pushed the #noissue_cleanup1 branch from 40cfe8e to a910ee4 Compare May 23, 2025 07:42
@codecov
Copy link
Copy Markdown

codecov bot commented May 23, 2025

Codecov Report

Attention: Patch coverage is 61.53846% with 5 lines in your changes missing coverage. Please review.

Project coverage is 33.59%. Comparing base (8b5a741) to head (9ce77bc).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...int/web/applicationmap/map/VirtualLinkHandler.java 33.33% 4 Missing ⚠️
...b/service/ProxyRequestTypeRegistryServiceImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #12475      +/-   ##
============================================
- Coverage     33.59%   33.59%   -0.01%     
- Complexity    10738    10740       +2     
============================================
  Files          3941     3941              
  Lines         91809    91809              
  Branches       9551     9553       +2     
============================================
- Hits          30846    30844       -2     
- Misses        58328    58332       +4     
+ Partials       2635     2633       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@emeroad emeroad force-pushed the #noissue_cleanup1 branch from a910ee4 to 9ce77bc Compare May 23, 2025 08:07
@emeroad emeroad merged commit 97630f8 into pinpoint-apm:master May 23, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants