Skip to content

Conversation

@KayzzzZ
Copy link
Collaborator

@KayzzzZ KayzzzZ commented May 29, 2025

This pull request introduces a new Application Performance Monitoring (APM) agent injection feature to the codebase, primarily for Linux builds. The changes include the addition of several new files and classes that manage the lifecycle of APM agents, including their installation, configuration, and removal. The new functionality is encapsulated in the apm directory and is integrated into the build system.

New APM agent injection system:

  • Build system integration: The apm directory is added to the list of subdirectories in the Linux build configuration (core/CMakeLists.txt), enabling compilation and inclusion of the new APM-related components.

Core APM agent management classes:

  • Agent injection runner: Introduces ApmInjectRunner (ApmInjectRunner.cpp, ApmInjectRunner.h), a singleton class responsible for initializing, scheduling, injecting, and removing APM agents. It manages agent lifecycle, retry logic, and periodic update checks via a timer event. [1] [2]
  • Attach manager: Adds AttachManager (AttachManager.cpp, AttachManager.h), which handles writing and removing agent runtime configuration files for target processes, as well as checking agent attachment status. [1] [2]
  • Package manager: Adds PackageManager (PackageManager.h), which manages downloading, installing, updating, and removing agent packages and exec hooks required for agent injection.

These changes lay the foundation for automated APM agent management, including installation, configuration, update scheduling, and cleanup, supporting future monitoring and instrumentation features.

这个拉取请求为代码库引入了一个新的应用性能监控(APM)代理注入功能,主要面向Linux构建。变更包括添加了几个新文件和类,用于管理APM代理的生命周期,包括它们的安装、配置和移除。新功能封装在apm目录中,并集成到构建系统中。

新的APM代理注入系统:

  • 构建系统集成: 在Linux构建配置(core/CMakeLists.txt)的子目录列表中添加了apm目录,支持编译和包含新的APM相关组件。

核心APM代理管理类:

  • 代理注入运行器: 引入了ApmInjectRunnerApmInjectRunner.cppApmInjectRunner.h),这是一个单例类,负责初始化、调度、注入和移除APM代理。它管理代理生命周期、重试逻辑,并通过定时器事件执行定期更新检查。
  • 附加管理器: 添加了AttachManagerAttachManager.cppAttachManager.h),用于处理目标进程的代理运行时配置文件的写入和移除,以及检查代理附加状态。
  • 包管理器: 添加了PackageManagerPackageManager.h),用于管理代理包和代理注入所需的执行钩子的下载、安装、更新和移除。

这些变更为自动化APM代理管理奠定了基础,包括安装、配置、更新调度和清理,支持未来的监控和仪表化功能。

@KayzzzZ KayzzzZ changed the title feat: support APM Java Agent inject [WIP] feat: support APM Java Agent inject May 29, 2025
@KayzzzZ KayzzzZ changed the title [WIP] feat: support APM Java Agent inject feat: support APM Java Agent inject Jun 20, 2025
@yyuuttaaoo yyuuttaaoo requested a review from Copilot September 17, 2025 12:25
Copy link
Contributor

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 adds support for APM (Application Performance Monitoring) Java Agent injection functionality to the system. The implementation includes downloading, installing, and managing APM agents for Java applications, along with comprehensive test coverage.

  • Adds APM agent injection capabilities with support for downloading and installing Java agents
  • Implements package management for APM agents including archive extraction and version management
  • Introduces task pipeline framework for managing APM injection configurations

Reviewed Changes

Copilot reviewed 32 out of 33 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
core/apm/.h, core/apm/.cpp Core APM functionality including types, package manager, attach manager, and injection runner
core/plugin/input/InputApmAgentInject.* APM agent injection task implementation
core/task_pipeline/* Task pipeline framework for managing APM configurations
core/common/ArchiveHelper.* Archive extraction utility for agent packages
core/unittest/apm/* Comprehensive unit tests for APM functionality
core/unittest/common/* Unit tests for archive helper and HTTP download functionality
core/dependencies.cmake, core/common/links.cmake Build system changes to link libarchive

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

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.

2 participants