Skip to content

[#noissue] Refactor application name retrieval to use getApplicationName()#13395

Open
emeroad wants to merge 1 commit intopinpoint-apm:masterfrom
emeroad:#noissue_appname
Open

[#noissue] Refactor application name retrieval to use getApplicationName()#13395
emeroad wants to merge 1 commit intopinpoint-apm:masterfrom
emeroad:#noissue_appname

Conversation

@emeroad
Copy link
Member

@emeroad emeroad commented Feb 11, 2026

…ame()

This pull request standardizes the way application names are accessed throughout the codebase by replacing calls to getName() with getApplicationName() on the Application object. This change improves consistency and helps prevent potential bugs related to ambiguous method naming. The update is applied across multiple modules, including alarm processing, data collection, application management, and associated tests.

Core Refactoring:

  • Replaced all usages of application.getName() with application.getApplicationName() in alarm processing logic, including rule selection and agent ID fetching in AlarmProcessor.java and AlarmReader.java. [1] [2] [3]
  • Updated all data collector classes (e.g., MapOutLinkDataCollector, DataSourceDataCollector, FileDescriptorDataCollector, HeapDataCollector, JvmCpuDataCollector, SystemCpuDataCollector) to use getApplicationName() for DAO queries and logging. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Application and Agent Management:

  • Modified service and job classes (e.g., AgentRemover, ApplicationCleaningProcessor, ApplicationRemover, BatchApplicationIndexServiceImpl) to use getApplicationName() for agent and application operations. [1] [2] [3] [4]

Web and API Layer Updates:

  • Updated web service and DAO layers (e.g., AgentsServiceImpl, AgentInfoServerGroupListDataSource, ApplicationResponse, MapScanKeyFactoryV2) to consistently use getApplicationName() when interacting with application-related data. [1] [2] [3] [4] [5]

Test Code Consistency:

  • Updated test classes to use getApplicationName() for mocking and verification, ensuring test consistency with production code. [1] [2]

These changes collectively enhance code clarity and reduce the risk of future errors related to application name retrieval.

@sonarqubecloud
Copy link

Copy link

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 pull request performs a comprehensive refactoring to standardize application name retrieval across the Pinpoint codebase by replacing all calls to Application.getName() with Application.getApplicationName(). The refactoring also introduces a new Service class and updates the Application class to include a service field, setting up infrastructure for future multi-tenancy support while maintaining backward compatibility.

Changes:

  • Deprecated getName() method on Application class and replaced all usages with getApplicationName() across the entire codebase
  • Added new Service class to support future service-level multi-tenancy
  • Updated Application class to include a Service field (defaulting to Service.DEFAULT for backward compatibility)
  • Applied changes consistently across web modules, batch jobs, alarm processors, data collectors, DAOs, mappers, serializers, and all test files

Reviewed changes

Copilot reviewed 65 out of 65 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
web/src/main/java/com/navercorp/pinpoint/web/vo/Service.java New class introducing Service concept with uid and name for multi-tenancy support
web/src/main/java/com/navercorp/pinpoint/web/vo/Application.java Added Service field, renamed internal field to applicationName, deprecated getName(), added getApplicationName()
web/src/main/java/com/navercorp/pinpoint/web/component/DefaultApplicationFactory.java Updated to construct Application with Service.DEFAULT
web/src/main/java/com/navercorp/pinpoint/web/view/ApplicationSerializer.java Updated JSON serialization to use getApplicationName()
web/src/main/java/com/navercorp/pinpoint/web/view/ApplicationScatterScanResultSerializer.java Updated JSON serialization to use getApplicationName() and reordered imports
web/src/main/java/com/navercorp/pinpoint/web/view/id/AgentNameView.java Updated to use getApplicationName()
web/src/main/java/com/navercorp/pinpoint/web/view/histogram/*.java Updated histogram views to use getApplicationName()
web/src/main/java/com/navercorp/pinpoint/web/service/*.java Updated service implementations to use getApplicationName() for operations
web/src/main/java/com/navercorp/pinpoint/web/applicationmap/**/*.java Updated all application map related classes (nodes, links, histograms, DAOs, mappers) to use getApplicationName()
web/src/main/java/com/navercorp/pinpoint/web/agentlist/service/AgentsServiceImpl.java Updated to use getApplicationName() with import reordering
web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/AdminController.java Updated admin operations to use getApplicationName()
web/src/main/java/com/navercorp/pinpoint/web/uid/service/ApplicationIndexV2CopyServiceImpl.java Updated V2 index copy operations to use getApplicationName()
web/src/main/java/com/navercorp/pinpoint/web/vo/ResponseHistograms.java Updated response histogram builder to use getApplicationName()
batch/src/main/java/com/navercorp/pinpoint/batch/alarm/*.java Updated alarm reader and processor to use getApplicationName()
batch/src/main/java/com/navercorp/pinpoint/batch/alarm/collector/**/*.java Updated all data collectors to use getApplicationName() for DAO queries and logging
batch/src/main/java/com/navercorp/pinpoint/batch/job/*.java Updated batch jobs for application and agent management to use getApplicationName()
batch/src/main/java/com/navercorp/pinpoint/batch/service/BatchApplicationIndexServiceImpl.java Updated batch application index service to use getApplicationName()
web/src/test/**/*.java Updated all test files to use getApplicationName() consistently with production code

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,48 @@
package com.navercorp.pinpoint.web.vo;
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

The Service class is missing the standard Apache License 2.0 copyright header that is present in other files in this codebase. Add the copyright header to maintain consistency with the project's licensing requirements.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 42.05607% with 62 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.10%. Comparing base (d1585a8) to head (6606479).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...in/java/com/navercorp/pinpoint/web/vo/Service.java 35.71% 9 Missing ⚠️
...point/web/service/ApplicationIndexServiceImpl.java 0.00% 6 Missing ⚠️
...alarm/collector/pinot/DataSourceDataCollector.java 37.50% 5 Missing ⚠️
...uid/service/ApplicationIndexV2CopyServiceImpl.java 0.00% 3 Missing ⚠️
...ava/com/navercorp/pinpoint/web/vo/Application.java 75.00% 3 Missing ⚠️
...npoint/batch/job/ApplicationCleaningProcessor.java 0.00% 2 Missing ⚠️
...atch/service/BatchApplicationIndexServiceImpl.java 0.00% 2 Missing ⚠️
...b/applicationmap/dao/mapper/DefaultLinkFilter.java 0.00% 2 Missing ⚠️
.../web/authorization/controller/AdminController.java 0.00% 2 Missing ⚠️
...navercorp/pinpoint/batch/alarm/AlarmProcessor.java 50.00% 1 Missing ⚠️
... and 27 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #13395      +/-   ##
============================================
- Coverage     33.11%   33.10%   -0.01%     
- Complexity    10967    10968       +1     
============================================
  Files          4066     4067       +1     
  Lines         94295    94314      +19     
  Branches       9811     9812       +1     
============================================
+ Hits          31225    31227       +2     
- Misses        60389    60404      +15     
- Partials       2681     2683       +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.

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.

1 participant