Bläddra i källkod

Feature #TASK_QT-18250 Novosight-Euspace改造-独立部署-cw字样替换

Tom.li 1 vecka sedan
förälder
incheckning
aca9bd9dab
36 ändrade filer med 79 tillägg och 79 borttagningar
  1. 11 11
      .cursor/ssd/specs/spec-novosight/tasks.md
  2. 1 1
      .github/prompts/.last_install_date
  3. 0 0
      dist/aarch64/package_dir/agents/NativeAgent/plugins/apm-javacode-plugin-ssl-socket.jar
  4. 0 0
      dist/aarch64/package_dir/libs/amd64/jvm/apmlibnet.so
  5. 0 0
      dist/aarch64/package_dir/libs/arm64/jvm/apmlibnet.so
  6. 0 0
      dist/aarch64/package_dir/scripts/apmjattach
  7. 2 2
      dist/aarch64/scripts/install_temp.sh
  8. 5 5
      dist/aarch64/scripts/package.sh
  9. 0 0
      dist/package_dir/agents/NativeAgent/plugins/apm-javacode-plugin-ssl-socket.jar
  10. 0 0
      dist/package_dir/libs/amd64/jvm/apmlibnet.so
  11. 0 0
      dist/package_dir/libs/arm64/jvm/apmlibnet.so
  12. 0 0
      dist/package_dir/scripts/apmjattach
  13. 2 2
      dist/scripts/install_temp.sh
  14. 0 0
      dist/x86_64/package_dir/agents/NativeAgent/plugins/apm-javacode-plugin-ssl-socket.jar
  15. 0 0
      dist/x86_64/package_dir/libs/amd64/jvm/apmlibnet.so
  16. 0 0
      dist/x86_64/package_dir/libs/arm64/jvm/apmlibnet.so
  17. 0 0
      dist/x86_64/package_dir/scripts/apmjattach
  18. 2 2
      dist/x86_64/scripts/install_temp.sh
  19. 5 5
      dist/x86_64/scripts/package.sh
  20. 9 9
      ebpftracer/ebpf/include/apm_trace.h
  21. 1 1
      ebpftracer/ebpf/l7/l7.c
  22. 8 8
      ebpftracer/ebpf/utrace/go/net/client.probe.bpf.c
  23. 5 5
      ebpftracer/ebpf/utrace/go/net/grpc.server.probe.bpf.c
  24. 5 5
      ebpftracer/ebpf/utrace/go/net/server.probe.bpf.c
  25. 1 1
      ebpftracer/ebpf/utrace/netcore/net/client.probe.bpf.c
  26. 1 1
      ebpftracer/jvm.go
  27. 1 1
      ebpftracer/l7/l7.go
  28. 2 2
      ebpftracer/tracer.go
  29. 1 1
      ebpftracer/tracer/inject/inject_linux_amd64.go
  30. 3 3
      ebpftracer/tracer/inject/inject_linux_arm64.go
  31. 2 2
      ebpftracer/tracer/jattach/jattach_linux_amd64.go
  32. 2 2
      ebpftracer/tracer/jattach/jattach_linux_arm64.go
  33. 2 2
      flags/flags.go
  34. 3 3
      pkg/go.opentelemetry.io/otel/exporters/otlp/otlptrace/apm_exporter.go
  35. 1 1
      utils/modelse/bpf_struct.go
  36. 4 4
      utils/util.go

+ 11 - 11
.cursor/ssd/specs/spec-novosight/tasks.md

@@ -63,7 +63,7 @@
   - _Requirements: 3_
 
 - [ ] 3. eBPF Header 常量重命名
-- [ ] 3.1 修改 apm_trace.h 中的 header 常量定义
+- [x] 3.1 修改 apm_trace.h 中的 header 常量定义
   - 将 CW_HEADER_KEY_LENGTH 从 7 改为 8
   - 将 CW_HEADER_KEY_VAL 从 "cwtrace" 改为 "apmtrace"
   - 将 CW_SYS_HEADER_KEY_LENGTH 从 7 改为 8
@@ -71,39 +71,39 @@
   - 确认 CW_STREAM_HEADER_LEN 宏自动级联为 136
   - _Requirements: 4_
 
-- [ ] 3.2 (P) 更新 server probe 中的字符串字面量和魔数
+- [x] 3.2 (P) 更新 server probe 中的字符串字面量和魔数
   - 替换 server.probe.bpf.c 中 "cwtrace: " → "apmtrace: "、"cwother: " → "apmother: "
   - 重新计算并替换小端序魔数("cwtrace:" 和 "cwother:" 对应的 8 字节魔数)
   - _Requirements: 4_
 
-- [ ] 3.3 (P) 更新 gRPC server probe 中的逐字节比较逻辑
+- [x] 3.3 (P) 更新 gRPC server probe 中的逐字节比较逻辑
   - 修改 grpc.server.probe.bpf.c 中 key 字节比较从 'c','w' 改为 'a','p','m'
   - 同步替换相关字符串字面量
   - _Requirements: 4_
 
-- [ ] 3.4 (P) 更新其他 C 文件中的 header 字符串引用
+- [x] 3.4 (P) 更新其他 C 文件中的 header 字符串引用
   - 扫描并替换所有 .c 文件中残余的 "cwtrace"/"cwother" 字符串字面量
   - 确保所有 probe(HTTP/gRPC/各语言)引用一致
   - _Requirements: 4_
 
-- [ ] 3.5 更新 Go 层 header 常量引用
+- [x] 3.5 更新 Go 层 header 常量引用
   - 同步 Go 代码中对 "cwtrace"/"cwother" 的字符串引用(如 tracer.go 中的日志)
   - 确保 Go 和 C 两层常量保持一致
   - _Requirements: 4, 5_
 
 - [ ] 4. Go 代码环境变量和路径去品牌化
-- [ ] 4.1 (P) 替换 flags.go 中的默认路径常量
+- [x] 4.1 (P) 替换 flags.go 中的默认路径常量
   - 将 common.ini 默认路径从 "/opt/cloudwise/omniagent/conf/common.ini" 改为 "/opt/apm/euspace/conf/common.ini"
   - _Requirements: 6, 7_
 
-- [ ] 4.2 (P) 替换 utils/util.go 中的环境变量和路径
+- [x] 4.2 (P) 替换 utils/util.go 中的环境变量和路径
   - 将 os.Getenv("CW_CONTAINER") 改为 os.Getenv("APM_CONTAINER")
   - 将 os.Getenv("CW_HOST_PID_ENABLE") 改为 os.Getenv("APM_HOST_PID_ENABLE")
   - 将 daemonid 路径从 "/opt/cloudwise/omniagent/meta/.daemonid" 改为 "/opt/apm/euspace/meta/.daemonid"
   - 评估 strings.EqualFold(filename, "cloudwise") 进程名匹配是否需要保留或修改
   - _Requirements: 6_
 
-- [ ] 4.3 (P) 替换 Go 日志文本中的品牌字样
+- [x] 4.3 (P) 替换 Go 日志文本中的品牌字样
   - 将 tracer.go 中 "cwother" 日志文本改为 "apmother"
   - 将 inject_linux_arm64.go 中 "cw enc" 日志文本改为 "apm enc"
   - 将 inject_aot.go 中的 cw 相关日志文本替换为 apm
@@ -111,18 +111,18 @@
   - _Requirements: 5_
 
 - [ ] 5. 编译验证和品牌扫描
-- [ ] 5.1 eBPF C 代码编译验证
+- [x] 5.1 eBPF C 代码编译验证
   - 编译双架构 BPF 程序,确保 BPF verifier 通过
   - 验证 buffer 大小计算正确(STREAM_HEADER_LEN = 136)
   - 确认无编译警告或错误
   - _Requirements: 4_
 
-- [ ] 5.2 Go 代码编译验证
+- [x] 5.2 Go 代码编译验证
   - 执行 go build 确认无编译错误
   - 运行现有单元测试确认无回归
   - _Requirements: 4, 5, 6_
 
-- [ ] 5.3 安装包品牌残留扫描
+- [x] 5.3 安装包品牌残留扫描
   - 对打包产出物执行 grep -ri "cloudwise\|cw" 确认零残留
   - 白名单确认:Java_com_cloudwise_* JNI 符号允许保留
   - 验证安装/卸载/服务管理脚本的完整性

+ 1 - 1
.github/prompts/.last_install_date

@@ -1 +1 @@
-2026-05-22
+2026-05-25

+ 0 - 0
dist/aarch64/package_dir/agents/NativeAgent/plugins/cloudwise-javacode-plugin-ssl-socket.jar → dist/aarch64/package_dir/agents/NativeAgent/plugins/apm-javacode-plugin-ssl-socket.jar


+ 0 - 0
dist/aarch64/package_dir/libs/amd64/jvm/cwlibnet.so → dist/aarch64/package_dir/libs/amd64/jvm/apmlibnet.so


+ 0 - 0
dist/aarch64/package_dir/libs/arm64/jvm/cwlibnet.so → dist/aarch64/package_dir/libs/arm64/jvm/apmlibnet.so


+ 0 - 0
dist/aarch64/package_dir/scripts/cwjattach → dist/aarch64/package_dir/scripts/apmjattach


+ 2 - 2
dist/aarch64/scripts/install_temp.sh

@@ -17,7 +17,7 @@ readonly BRAND_PARENT_PRODUCT_NAME="euspace"
 readonly BRAND_AGENT_PRODUCT_NAME="${BRAND_FORMAL_NAME} ${BRAND_PRODUCT_NAME}"
 readonly BRAND_FORMAL_NAME_LOWER="apm"
 readonly BRAND_PRODUCT_NAME_LOWER="euspace"
-readonly BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME_CLOUDWISE="apm"
+readonly BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME_APM="apm"
 
 readonly AIX_DF_SPECIFIC_FLAG=
 readonly CONF_LD_PRELOAD=
@@ -855,7 +855,7 @@ readonly CONF_FIELD_NM_NON_ROOT_MODE="NonRootMode"
 #== 配置默认用户权限
 readonly BASE_OMNI_INSTALL_DIR=${INSTALL_BASE}/${BRAND_FORMAL_NAME_LOWER}/${BRAND_PARENT_PRODUCT_NAME}
 readonly BASE_OMNI_INSTALL_CONF_DIR=${BASE_OMNI_INSTALL_DIR}/conf/installation.conf
-BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME="$(getValueFromConfigFile "${CONF_FIELD_NM_GROUP}" "${BASE_OMNI_INSTALL_CONF_DIR}" "${BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME_CLOUDWISE}")"
+BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME="$(getValueFromConfigFile "${CONF_FIELD_NM_GROUP}" "${BASE_OMNI_INSTALL_CONF_DIR}" "${BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME_APM}")"
 
 #== Those are read from params section appended to installer by the server
 #== 【0】=【参数】数据服务地址

+ 5 - 5
dist/aarch64/scripts/package.sh

@@ -9,17 +9,17 @@ readonly CURR_FILE_NAME="$(basename "$0")"
 readonly SMARTAGENT_DIR=$(cd $SCRIPT_DIR/../ && pwd)
 readonly SMARTAGENT_PARENT_DIR=$(cd $SCRIPT_DIR/../../ && pwd)
 
-readonly BRAND_FORMAL_NAME="Cloudwise"
+readonly BRAND_FORMAL_NAME="APM"
 BRAND_PRODUCT_NAME="euspace"
 BRAND_AGENT_PRODUCT_NAME="${BRAND_FORMAL_NAME}-${BRAND_PRODUCT_NAME}"
-readonly BRAND_FORMAL_NAME_LOWER="cloudwise"
-readonly BRAND_PRODUCT_NAME_LOWER="cwserveragent"
-readonly BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME="ucloudwise"
+readonly BRAND_FORMAL_NAME_LOWER="apm"
+readonly BRAND_PRODUCT_NAME_LOWER="euspace"
+readonly BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME="apm"
 
 
 readonly BAK_EXT_NAME=".bak"
 #== cw-serveragent
-readonly SERVICE_SCRIPT_FILE="cw-oneagent"
+readonly SERVICE_SCRIPT_FILE="apm-euspace"
 readonly XZDEC_NAME="xzdec"
 readonly INSTALL_TEMP_FILE_NAME="install_temp.sh"
 readonly INSTALL_VERSION_FILE_NAME="installer.version"

+ 0 - 0
dist/package_dir/agents/NativeAgent/plugins/cloudwise-javacode-plugin-ssl-socket.jar → dist/package_dir/agents/NativeAgent/plugins/apm-javacode-plugin-ssl-socket.jar


+ 0 - 0
dist/package_dir/libs/amd64/jvm/cwlibnet.so → dist/package_dir/libs/amd64/jvm/apmlibnet.so


+ 0 - 0
dist/package_dir/libs/arm64/jvm/cwlibnet.so → dist/package_dir/libs/arm64/jvm/apmlibnet.so


+ 0 - 0
dist/package_dir/scripts/cwjattach → dist/package_dir/scripts/apmjattach


+ 2 - 2
dist/scripts/install_temp.sh

@@ -17,7 +17,7 @@ readonly BRAND_PARENT_PRODUCT_NAME="omniagent"
 readonly BRAND_AGENT_PRODUCT_NAME="${BRAND_FORMAL_NAME} ${BRAND_PRODUCT_NAME}"
 readonly BRAND_FORMAL_NAME_LOWER="cloudwise"
 readonly BRAND_PRODUCT_NAME_LOWER="euspace"
-readonly BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME_CLOUDWISE="cloudwise"
+readonly BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME_APM="cloudwise"
 
 readonly AIX_DF_SPECIFIC_FLAG=
 readonly CONF_LD_PRELOAD=
@@ -855,7 +855,7 @@ readonly CONF_FIELD_NM_NON_ROOT_MODE="NonRootMode"
 #== 配置默认用户权限
 readonly BASE_OMNI_INSTALL_DIR=${INSTALL_BASE}/${BRAND_FORMAL_NAME_LOWER}/${BRAND_PARENT_PRODUCT_NAME}
 readonly BASE_OMNI_INSTALL_CONF_DIR=${BASE_OMNI_INSTALL_DIR}/conf/installation.conf
-BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME="$(getValueFromConfigFile "${CONF_FIELD_NM_GROUP}" "${BASE_OMNI_INSTALL_CONF_DIR}" "${BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME_CLOUDWISE}")"
+BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME="$(getValueFromConfigFile "${CONF_FIELD_NM_GROUP}" "${BASE_OMNI_INSTALL_CONF_DIR}" "${BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME_APM}")"
 
 #== Those are read from params section appended to installer by the server
 #== 【0】=【参数】数据服务地址

+ 0 - 0
dist/x86_64/package_dir/agents/NativeAgent/plugins/cloudwise-javacode-plugin-ssl-socket.jar → dist/x86_64/package_dir/agents/NativeAgent/plugins/apm-javacode-plugin-ssl-socket.jar


+ 0 - 0
dist/x86_64/package_dir/libs/amd64/jvm/cwlibnet.so → dist/x86_64/package_dir/libs/amd64/jvm/apmlibnet.so


+ 0 - 0
dist/x86_64/package_dir/libs/arm64/jvm/cwlibnet.so → dist/x86_64/package_dir/libs/arm64/jvm/apmlibnet.so


+ 0 - 0
dist/x86_64/package_dir/scripts/cwjattach → dist/x86_64/package_dir/scripts/apmjattach


+ 2 - 2
dist/x86_64/scripts/install_temp.sh

@@ -17,7 +17,7 @@ readonly BRAND_PARENT_PRODUCT_NAME="euspace"
 readonly BRAND_AGENT_PRODUCT_NAME="${BRAND_FORMAL_NAME} ${BRAND_PRODUCT_NAME}"
 readonly BRAND_FORMAL_NAME_LOWER="apm"
 readonly BRAND_PRODUCT_NAME_LOWER="euspace"
-readonly BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME_CLOUDWISE="apm"
+readonly BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME_APM="apm"
 
 readonly AIX_DF_SPECIFIC_FLAG=
 readonly CONF_LD_PRELOAD=
@@ -855,7 +855,7 @@ readonly CONF_FIELD_NM_NON_ROOT_MODE="NonRootMode"
 #== 配置默认用户权限
 readonly BASE_OMNI_INSTALL_DIR=${INSTALL_BASE}/${BRAND_FORMAL_NAME_LOWER}/${BRAND_PARENT_PRODUCT_NAME}
 readonly BASE_OMNI_INSTALL_CONF_DIR=${BASE_OMNI_INSTALL_DIR}/conf/installation.conf
-BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME="$(getValueFromConfigFile "${CONF_FIELD_NM_GROUP}" "${BASE_OMNI_INSTALL_CONF_DIR}" "${BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME_CLOUDWISE}")"
+BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME="$(getValueFromConfigFile "${CONF_FIELD_NM_GROUP}" "${BASE_OMNI_INSTALL_CONF_DIR}" "${BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME_APM}")"
 
 #== Those are read from params section appended to installer by the server
 #== 【0】=【参数】数据服务地址

+ 5 - 5
dist/x86_64/scripts/package.sh

@@ -9,17 +9,17 @@ readonly CURR_FILE_NAME="$(basename "$0")"
 readonly SMARTAGENT_DIR=$(cd $SCRIPT_DIR/../ && pwd)
 readonly SMARTAGENT_PARENT_DIR=$(cd $SCRIPT_DIR/../../ && pwd)
 
-readonly BRAND_FORMAL_NAME="Cloudwise"
+readonly BRAND_FORMAL_NAME="APM"
 BRAND_PRODUCT_NAME="euspace"
 BRAND_AGENT_PRODUCT_NAME="${BRAND_FORMAL_NAME}-${BRAND_PRODUCT_NAME}"
-readonly BRAND_FORMAL_NAME_LOWER="cloudwise"
-readonly BRAND_PRODUCT_NAME_LOWER="cwserveragent"
-readonly BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME="ucloudwise"
+readonly BRAND_FORMAL_NAME_LOWER="apm"
+readonly BRAND_PRODUCT_NAME_LOWER="euspace"
+readonly BRAND_AGENT_DEFAULT_USER_AND_GROUP_NAME="apm"
 
 
 readonly BAK_EXT_NAME=".bak"
 #== cw-serveragent
-readonly SERVICE_SCRIPT_FILE="cw-oneagent"
+readonly SERVICE_SCRIPT_FILE="apm-euspace"
 readonly XZDEC_NAME="xzdec"
 readonly INSTALL_TEMP_FILE_NAME="install_temp.sh"
 readonly INSTALL_VERSION_FILE_NAME="installer.version"

+ 9 - 9
ebpftracer/ebpf/include/apm_trace.h

@@ -26,24 +26,24 @@
 #define APM_ASSUMED_APP_ID_SIZE 8
 #define APM_SPAN_ID_SIZE 8
 
-// cwtrace
+// apmtrace
 
-#define CW_HEADER_KEY_LENGTH 7
-#define CW_HEADER_KEY_VAL "cwtrace"
-#define CW_HEADER_KEY_UFIRST_VAL "Cwtrace"
+#define CW_HEADER_KEY_LENGTH 8
+#define CW_HEADER_KEY_VAL "apmtrace"
+#define CW_HEADER_KEY_UFIRST_VAL "Apmtrace"
 #define CW_HEADER_VAL_LENGTH 123
 #define CW_HEADER_LENGTH 123
-//#define CW_STREAM_HEADER_LEN 135 // CW_HEADER_KEY_LENGTH + 2 + CW_HEADER_VAL_LENGTH + 2 + 1
+//#define CW_STREAM_HEADER_LEN 136 // CW_HEADER_KEY_LENGTH + 2 + CW_HEADER_VAL_LENGTH + 2 + 1
 #define CW_STREAM_HEADER_LEN (CW_HEADER_KEY_LENGTH + 2 + CW_HEADER_VAL_LENGTH + 2 + 1)
 
-// cwother
+// apmother
 // 格式:NN:ParentServiceName:MM[:ParentServiceSysTag]
 // NN: 2位数字(ASCII),表示 ParentServiceName 的长度(0-32)
 // MM: 2位数字(ASCII),表示 ParentServiceSysTag 的长度(0-32)
 // 当 MM=00 时,格式为 NN:ParentServiceName:00(不包含最后的冒号和SysTag)
-#define CW_SYS_HEADER_KEY_LENGTH 7
-#define CW_SYS_HEADER_KEY_VAL "cwother"
-#define CW_SYS_HEADER_KEY_UFIRST_VAL "Cwother"
+#define CW_SYS_HEADER_KEY_LENGTH 8
+#define CW_SYS_HEADER_KEY_VAL "apmother"
+#define CW_SYS_HEADER_KEY_UFIRST_VAL "Apmother"
 #define CW_SYS_LEN_PREFIX_LENGTH 2  // 每个长度字段的长度(NN 或 MM)
 #define CW_SYS_HEADER_VAL_LENGTH 76
 

+ 1 - 1
ebpftracer/ebpf/l7/l7.c

@@ -103,7 +103,7 @@ struct l7_event {
 	unsigned char app_id_from[APM_APP_ID_SIZE];
 	unsigned char span_id_from[APM_SPAN_ID_SIZE];
     unsigned char type_from[APM_TYPE_FROM_SIZE];
-    unsigned char sysvc_from[76];  // cwother header value: NN:ParentServiceName:MM:ParentServiceSysTag (CW_SYS_HEADER_VAL_LENGTH)
+    unsigned char sysvc_from[76];  // apmother header value: NN:ParentServiceName:MM:ParentServiceSysTag (CW_SYS_HEADER_VAL_LENGTH)
     unsigned char target_addr[64];
 
     // 错误消息字段

+ 8 - 8
ebpftracer/ebpf/utrace/go/net/client.probe.bpf.c

@@ -630,8 +630,8 @@ int uprobe_writeSubset(struct pt_regs *ctx) {
 			}
 
 			if (len < (size - CW_HEADER_VAL_LENGTH - CW_HEADER_KEY_LENGTH - 4)) { // 4 = strlen(": ") + strlen("\r\n")
-				// Initialize tp_str with "cwtrace: "
-				__builtin_memcpy(storage->tp_str, "cwtrace: ", CW_HEADER_KEY_LENGTH + 2);
+				// Initialize tp_str with "apmtrace: "
+				__builtin_memcpy(storage->tp_str, "apmtrace: ", CW_HEADER_KEY_LENGTH + 2);
 				__builtin_memcpy(&storage->tp_str[CW_HEADER_KEY_LENGTH + 2], storage->tp, sizeof(storage->tp));
 				__builtin_memcpy(storage->end, "\r\n", 2);
 				__builtin_memcpy(&storage->tp_str[CW_HEADER_KEY_LENGTH + 2 + CW_HEADER_VAL_LENGTH], storage->end, sizeof(storage->end));
@@ -646,7 +646,7 @@ int uprobe_writeSubset(struct pt_regs *ctx) {
 				}
 			}
 			
-			// 插入 cwother header
+			// 插入 apmother header
 			// 直接从 proc_info->sysvc 获取值
 			u32 sys_map_id = 0;
 			struct cw_sys_header_storage *sys_storage = bpf_map_lookup_elem(&cw_sys_header_storage_map, &sys_map_id);
@@ -671,20 +671,20 @@ int uprobe_writeSubset(struct pt_regs *ctx) {
 					}
 
 					// 检查缓冲区空间
-					u32 total_header_len = CW_SYS_HEADER_KEY_LENGTH + 2 + sys_val_len + 2; // "cwother: " + sys_val + "\r\n"
+					u32 total_header_len = CW_SYS_HEADER_KEY_LENGTH + 2 + sys_val_len + 2; // "apmother: " + sys_val + "\r\n"
 					if (len + total_header_len <= size) {
-						// Initialize sys_str with "cwother: "
-						__builtin_memcpy(sys_storage->sys_str, "cwother: ", CW_SYS_HEADER_KEY_LENGTH + 2);
+						// Initialize sys_str with "apmother: "
+						__builtin_memcpy(sys_storage->sys_str, "apmother: ", CW_SYS_HEADER_KEY_LENGTH + 2);
 						__builtin_memcpy(&sys_storage->sys_str[CW_SYS_HEADER_KEY_LENGTH + 2], sys_storage->sys_val, CW_SYS_HEADER_VAL_LENGTH);
 						__builtin_memcpy(&sys_storage->sys_str[CW_SYS_HEADER_KEY_LENGTH + 2 + sys_val_len], "\r\n", 2);
 
 						if (bpf_probe_write_user(buf_ptr + (len & 0x0ffff), sys_storage->sys_str, total_header_len)) {
-							cw_bpf_debug("uprobe_writeSubset: Failed to write cwother header in buffer");
+							cw_bpf_debug("uprobe_writeSubset: Failed to write apmother header in buffer");
 							goto done;
 						}
 						len += total_header_len;
 						if (bpf_probe_write_user((void *) (io_writer_ptr + proc_info->io_writer_n_pos), &len, sizeof(len))) {
-							cw_bpf_debug("uprobe_writeSubset: Failed to change io writer n for cwother");
+							cw_bpf_debug("uprobe_writeSubset: Failed to change io writer n for apmother");
 							goto done;
 						}
 					}

+ 5 - 5
ebpftracer/ebpf/utrace/go/net/grpc.server.probe.bpf.c

@@ -623,7 +623,7 @@ int uprobe_http2Server_operateHeader(struct pt_regs *ctx) {
     void *frame_ptr = info->is_new_frame_pos ? arg4 : arg2;
     struct go_slice header_fields = {};
     bpf_probe_read(&header_fields, sizeof(header_fields), (void *)(frame_ptr + frame_fields_pos));
-    char key[CW_HEADER_KEY_LENGTH + 1] = "cwtrace";
+    char key[CW_HEADER_KEY_LENGTH + 1] = "apmtrace";
     // 确保字符串以 null 结尾
     key[CW_HEADER_KEY_LENGTH] = '\0';
     // cw_bpf_debug("enter the uprobe_http2Server_operateHeader\n");
@@ -659,11 +659,11 @@ int uprobe_http2Server_operateHeader(struct pt_regs *ctx) {
 
         current_key[CW_HEADER_KEY_LENGTH] = '\0';
 
-        // cw_bpf_debug("---11111found cwtrace key is %s", key);
-        // cw_bpf_debug("+++11111found cwtrace current_key is %s", current_key);
+        // cw_bpf_debug("---11111found apmtrace key is %s", key);
+        // cw_bpf_debug("+++11111found apmtrace current_key is %s", current_key);
         // 简化字符串比较
-        // if (bpf_memcmp(key, current_key, 6) == 0) {
-        if (current_key[0] == 'c' && current_key[1] == 'w' && current_key[2] == 't' && current_key[3] == 'r' && current_key[4] == 'a' && current_key[5] == 'c' && current_key[6] == 'e') {
+        // if (bpf_memcmp(key, current_key, 8) == 0) {
+        if (current_key[0] == 'a' && current_key[1] == 'p' && current_key[2] == 'm' && current_key[3] == 't' && current_key[4] == 'r' && current_key[5] == 'a' && current_key[6] == 'c' && current_key[7] == 'e') {
             find_w3c = 1;
             // cw_bpf_debug("found traceparent header");
             // 执行字符串到span context的转换

+ 5 - 5
ebpftracer/ebpf/utrace/go/net/server.probe.bpf.c

@@ -344,7 +344,7 @@ int uprobe_textproto_Reader_readContinuedLineSlice_Returns(struct pt_regs *ctx)
 	u64 len = (u64) GO_PARAM2(ctx);
 	u8 *buf = (u8 *) GO_PARAM1(ctx);
 	if (len == (CW_HEADER_KEY_LENGTH + CW_HEADER_VAL_LENGTH + 2)) {
-		long cw_header_native = 0x3A65636172747763LL; // 小端序下的 "cwtrace:"
+		long cw_header_native = 0x65636172746D7061LL; // 小端序下的 "apmtrace"
 		__u64 key64 = 0;
 		bpf_probe_read_user(&key64, sizeof(key64), buf);
 		if (key64 == cw_header_native) {
@@ -354,10 +354,10 @@ int uprobe_textproto_Reader_readContinuedLineSlice_Returns(struct pt_regs *ctx)
 			bpf_map_update_elem(&http_server_context_headers, &key, &header_val, BPF_ANY);
 		}
 	}
-	// cwother: 08:service:03:tag
-	// 解析 cwother header (变长,需要检查是否匹配)
-	if (len >= (CW_SYS_HEADER_KEY_LENGTH + 2 + 8)) {  // 至少 "cwother: NN:name:MM " 的长度
-		long cw_sys_header_native = 0x3A726568746F7763LL; // 小端序下的 "cwother:"
+	// apmother: 08:service:03:tag
+	// 解析 apmother header (变长,需要检查是否匹配)
+	if (len >= (CW_SYS_HEADER_KEY_LENGTH + 2 + 8)) {  // 至少 "apmother: NN:name:MM " 的长度
+		long cw_sys_header_native = 0x726568746F6D7061LL; // 小端序下的 "apmother"
 		__u64 key64 = 0;
 		bpf_probe_read_user(&key64, sizeof(key64), buf);
 		if (key64 == cw_sys_header_native) {

+ 1 - 1
ebpftracer/ebpf/utrace/netcore/net/client.probe.bpf.c

@@ -79,7 +79,7 @@ static __inline struct sock_t* buildHeader2(struct sock_t *map_data) {
 //	__builtin_memset(map_data_res, 0, sizeof(struct sock_t));
 //	char header[5] = "cwt\r\n";
 
-//	char header[CW_STREAM_HEADER_LEN] = "cwtrace: 00:00:1015481350055581:5450531005555981:5610250100539899:304775019cd3218a304775019cd3218a:1001025098564810:140acc88cde8773f\r\n";
+//	char header[CW_STREAM_HEADER_LEN] = "apmtrace: 00:00:1015481350055581:5450531005555981:5610250100539899:304775019cd3218a304775019cd3218a:1001025098564810:140acc88cde8773f\r\n";
 	struct apm_span_context *cw_span_context = bpf_map_lookup_elem(&apm_span_context_heap, &key);
 
 	if (cw_span_context == NULL){

+ 1 - 1
ebpftracer/jvm.go

@@ -147,7 +147,7 @@ func (t *Tracer) AttachJavaNetWriteUprobes(pid uint32, rootfs string) ([]link.Li
 	}
 	var err error
 	libnetso := "libnet.so"
-	elfFileName := "cwlibnet.so"
+	elfFileName := "apmlibnet.so"
 
 	//inject
 	originFunc := symbolsocketWrite0

+ 1 - 1
ebpftracer/l7/l7.go

@@ -275,7 +275,7 @@ type RequestData struct {
 		SpanIdFrom     string
 		TypeFrom       TypeFrom
 	}
-	SysvcFrom string // cwother header value: NN:ParentServiceName:MM:ParentServiceSysTag
+	SysvcFrom string // apmother header value: NN:ParentServiceName:MM:ParentServiceSysTag
 	ErrorMsg  string
 	IsTls     bool
 	MQTopic   string // MQ topic (e.g., Kafka topic)

+ 2 - 2
ebpftracer/tracer.go

@@ -545,7 +545,7 @@ type l7Event struct {
 	AppIdFrom           HashByte
 	SpanIdFrom          HashByte
 	TypeFrom            [1]byte
-	SysvcFrom           [76]byte // cwother header value: NN:ParentServiceName:MM:ParentServiceSysTag
+	SysvcFrom           [76]byte // apmother header value: NN:ParentServiceName:MM:ParentServiceSysTag
 	RPCTarget           [64]byte
 	ErrorMsg            HashByte128
 	MQ                  struct {
@@ -800,7 +800,7 @@ func runEventsReader(name string, r *perf.Reader, ch chan<- Event, typ perfMapTy
 				req.ParentSpanContext.SpanIdFrom = hex.EncodeToString(v.SpanIdFrom[:])
 				req.ParentSpanContext.TypeFrom = l7.TypeFrom(hex.EncodeToString(v.TypeFrom[:]))
 				req.SysvcFrom = utils.BytesToString(v.SysvcFrom[:])
-				klog.Debugf("cwother '%s'", req.SysvcFrom)
+					klog.Debugf("apmother '%s'", req.SysvcFrom)
 				// klog.Debugf("req.ParentSpanContext.TraceIdFrom %s", req.ParentSpanContext.TraceIdFrom)
 				// klog.Debugf("req.ParentSpanContext.TypeFrom %s", req.ParentSpanContext.TypeFrom)
 				req.SAddr = ipPort(v.SAddr, v.Sport)

+ 1 - 1
ebpftracer/tracer/inject/inject_linux_amd64.go

@@ -575,7 +575,7 @@ func (j *JvmInjector) InitProg() error {
 	debugSoFilePhysicalPath := filepath.Join(j.Rootfs, debugSoFilePathInProc)
 	_, noFileErr := os.Stat(debugSoFilePhysicalPath)
 
-	// find cwlibnet.so in proc maps
+	// find apmlibnet.so in proc maps
 	var readDebugSoPathInMaps string
 	_, readDebugSoPathInMaps, j.DebugLibNetInfo.MapFile, j.DebugLibNetInfo.FileDeleted, _ = FindLibBaseFromProcMaps(j.Pid, j.DebugLibNetInfo.LibName)
 	j.DebugLibNetInfo.LibPath = debugSoFilePhysicalPath

+ 3 - 3
ebpftracer/tracer/inject/inject_linux_arm64.go

@@ -681,7 +681,7 @@ func (j *JvmInjector) InitProg() error {
 	debugSoFilePhysicalPath := filepath.Join(j.Rootfs, debugSoFilePathInProc)
 	_, noFileErr := os.Stat(debugSoFilePhysicalPath)
 
-	// find cwlibnet.so in proc maps
+	// find apmlibnet.so in proc maps
 	var readDebugSoPathInMaps string
 	_, readDebugSoPathInMaps, j.DebugLibNetInfo.MapFile, j.DebugLibNetInfo.FileDeleted, _ = FindLibBaseFromProcMaps(j.Pid, j.DebugLibNetInfo.LibName)
 	j.DebugLibNetInfo.LibPath = debugSoFilePhysicalPath
@@ -888,7 +888,7 @@ func buildCwNopEnc(pid int, nopAddr, originAddr uintptr) error {
 	klog.Infof("0x%016x\n", originalData) // 16个字符宽度,左边补0
 
 	if originalData != 0xd503201f {
-		return fmt.Errorf("The cw enc not nop <0x%016x>\n", originAddr)
+		return fmt.Errorf("The apm enc not nop <0x%016x>\n", originAddr)
 	}
 	/*
 		sub sp, sp, #0x80      ; 分配栈空间
@@ -1333,7 +1333,7 @@ func JvmInject(jvmInjector *JvmInjector) error {
 		return err
 	}
 	// 保存原始指令并扩充新指令
-	klog.Infof("[inject] %d build cw enc", pid)
+	klog.Infof("[inject] %d build apm enc", pid)
 	err = buildCwNopEnc(pid, debugFuncEnterAddr, originFuncEnterAddr)
 	if err != nil {
 		klog.Errorln(err)

+ 2 - 2
ebpftracer/tracer/jattach/jattach_linux_amd64.go

@@ -27,7 +27,7 @@ type JvmJattacher struct {
 
 func (j *JvmJattacher) JAttach() (int, error) {
 	// cmd方式
-	cwJattachCmdPath := utils.GetDefaultScriptsPath("cwjattach")
+	cwJattachCmdPath := utils.GetDefaultScriptsPath("apmjattach")
 	// 执行升级
 	args := []string{fmt.Sprintf("%d", j.Pid)}
 	args = append(args, j.Args...)
@@ -60,7 +60,7 @@ func (j *JvmJattacher) JAttach() (int, error) {
 
 func (j *JvmJattacher) JDetach() (int, error) {
 	// cmd方式
-	cwJattachCmdPath := utils.GetDefaultScriptsPath("cwjattach")
+	cwJattachCmdPath := utils.GetDefaultScriptsPath("apmjattach")
 	// 执行升级
 	args := []string{fmt.Sprintf("%d", j.Pid)}
 	args = append(args, j.Args...)

+ 2 - 2
ebpftracer/tracer/jattach/jattach_linux_arm64.go

@@ -27,7 +27,7 @@ type JvmJattacher struct {
 
 func (j *JvmJattacher) JAttach() (int, error) {
 	// cmd方式
-	cwJattachCmdPath := utils.GetDefaultScriptsPath("cwjattach")
+	cwJattachCmdPath := utils.GetDefaultScriptsPath("apmjattach")
 	// 执行升级
 	args := []string{fmt.Sprintf("%d", j.Pid)}
 	args = append(args, j.Args...)
@@ -60,7 +60,7 @@ func (j *JvmJattacher) JAttach() (int, error) {
 
 func (j *JvmJattacher) JDetach() (int, error) {
 	// cmd方式
-	cwJattachCmdPath := utils.GetDefaultScriptsPath("cwjattach")
+	cwJattachCmdPath := utils.GetDefaultScriptsPath("apmjattach")
 	// 执行升级
 	args := []string{fmt.Sprintf("%d", j.Pid)}
 	args = append(args, j.Args...)

+ 2 - 2
flags/flags.go

@@ -22,7 +22,7 @@ var (
 	LogLevel            = kingpin.Flag("log-level", "Log level").Envar("LOG_LEVEL").Default("").String()
 	ConsoleLog          = kingpin.Flag("console-log", "Console log").Envar("CONSOLE_LOG").Default("false").Bool()
 	EbpfFilePath        = kingpin.Flag("ebpf-path", "Set ebpf file path").Envar("EBPF_FILE").Default("").String()
-	CommonIni           = kingpin.Flag("common.ini", "Set ebpf file path").Envar("COMMON_INI").Default("/opt/cloudwise/omniagent/conf/common.ini").String()
+	CommonIni           = kingpin.Flag("common.ini", "Set ebpf file path").Envar("COMMON_INI").Default("/opt/apm/euspace/conf/common.ini").String()
 	ServerPrefix        = kingpin.Flag("server-prefix", "server-prefix").Envar("SERVER_PREFIX").Default("").String()
 	DisableRegisterHost = kingpin.Flag("disable-reg-host", "Disable reg host").Default("false").Envar("DISABLE_REG_HOST").Bool()
 	// agent
@@ -71,7 +71,7 @@ var (
 	// debug
 	Test = kingpin.Flag("test", "Only test").Default("false").Envar("TEST").Bool()
 	// op 新增配置
-	SysTag = kingpin.Flag("sys-tag", "sys tag").Envar("CW_SYS").Default("").String()
+	SysTag = kingpin.Flag("sys-tag", "sys tag").Envar("APM_SYS").Default("").String()
 	// l7
 	MysqlDefault = kingpin.Flag("mysql-default", "Default MySQL protocol when port-based detection fails").Envar("MYSQL_DEFAULT").Default("mysql").String()
 

+ 3 - 3
pkg/go.opentelemetry.io/otel/exporters/otlp/otlptrace/apm_exporter.go

@@ -94,9 +94,9 @@ type RootDataT struct {
 	ContainerID     string `json:"container_id"`
 	Sys             string `json:"sys"`
 	SystemUUID      string `json:"system_uuid"`
-	ParentSys       string `json:"parent_sys"`        // from cwother header: SysTag
-	AppNameFrom     string `json:"app_name_from"`     // from cwother header: app_name
-	ServiceTypeFrom string `json:"service_type_from"` // from cwother header: appServiceType
+	ParentSys       string `json:"parent_sys"`        // from apmother header: SysTag
+	AppNameFrom     string `json:"app_name_from"`     // from apmother header: app_name
+	ServiceTypeFrom string `json:"service_type_from"` // from apmother header: appServiceType
 	//i6000需要,增加process_jvm_id
 	ProcessJvmId int64 `json:"process_jvm_id"`
 }

+ 1 - 1
utils/modelse/bpf_struct.go

@@ -234,7 +234,7 @@ type EbpfProcInfo struct {
 	// net.TCPAddr offsets
 	TcpAddrIPOffset   uint64 // net.TCPAddr.IP field offset
 	TcpAddrPortOffset uint64 // net.TCPAddr.Port field offset
-	// cwother header value: {app_name_len}:app_name:{SysTagLen}[:SysTag]
+	// apmother header value: {app_name_len}:app_name:{SysTagLen}[:SysTag]
 	Sysvc [76]byte // CW_SYS_HEADER_VAL_LENGTH
 }
 

+ 4 - 4
utils/util.go

@@ -66,7 +66,7 @@ func init() {
 	//log.Infof("omniagent work path %s", agentdaemon_home)
 
 	_, filename := filepath.Split(agentdaemon_home)
-	if !strings.EqualFold(filename, "omniagent") && !strings.EqualFold(filename, "doccagent") && !strings.EqualFold(filename, "cloudwise") {
+	if !strings.EqualFold(filename, "omniagent") && !strings.EqualFold(filename, "doccagent") && !strings.EqualFold(filename, "apm") {
 		// 考虑后续支持自定义目录安装的情况 卸载逻辑在uninstall.sh中判断
 		//panic(errors.New(fmt.Sprintf("get exec path[%s] is not doccagent work path panic error", agentdaemon_home)))
 	}
@@ -714,7 +714,7 @@ func NewInstallPathParams(installPath string) []string {
 }
 
 func GetHostPid(pid int) (int, error) {
-	if os.Getenv("CW_CONTAINER") == "true" {
+	if os.Getenv("APM_CONTAINER") == "true" {
 		if cntrPidConvert != nil {
 			hostPid, err := cntrPidConvert.getHostPidByHostProc(pid)
 			if err != nil {
@@ -768,7 +768,7 @@ type cntrPidConvertMgr struct {
 var cntrPidConvert *cntrPidConvertMgr
 
 func initCntrPidConvert() {
-	if os.Getenv("CW_CONTAINER") == "true" && os.Getenv("CW_HOST_PID_ENABLE") != "true" {
+	if os.Getenv("APM_CONTAINER") == "true" && os.Getenv("APM_HOST_PID_ENABLE") != "true" {
 		if hostPid, err := getHostPidBySched(1); err == nil && hostPid > 1 {
 			log.Infof("not need convert cntrPid to hostPid")
 			return
@@ -853,7 +853,7 @@ func parseProcDirectory(dirPath string, daemonid []byte) (pidMap map[int]int, er
 			if err != nil {
 				continue
 			}
-			daemonidFilePath := filepath.Join(dirPath, pid, "root/opt/cloudwise/omniagent/meta/.daemonid")
+			daemonidFilePath := filepath.Join(dirPath, pid, "root/opt/apm/euspace/meta/.daemonid")
 
 			// 检查是否存在指定文件并size等于指定大小
 			fileInfo, err = os.Stat(daemonidFilePath)