Skip to content

<feature>[sdk]: support log server#4108

Open
ZStack-Robot wants to merge 1 commit into
zsv_5.1.0from
sync/zstackio/ZSV-12254@@3
Open

<feature>[sdk]: support log server#4108
ZStack-Robot wants to merge 1 commit into
zsv_5.1.0from
sync/zstackio/ZSV-12254@@3

Conversation

@ZStack-Robot
Copy link
Copy Markdown
Collaborator

DBImpact
GlobalConfigImpact

Resolves: ZSV-12254

Change-Id: I77716165756971736379716977626b6f6f65656e

sync from gitlab !10004

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Review Change Stack

Walkthrough

本 PR 为 Log Server 增加持久化表与注释、全局配置,扩展 SDK 数据模型(枚举/Inventory),并实现新增/删除/更新/查询 四个 SDK 动作、类型映射与生成器输出子路径配置。

Changes

Log Server 功能实现

Layer / File(s) Summary
数据模型与配置
conf/db/zsv/V5.1.0__schema.sql, core/src/main/java/org/zstack/core/log/LogGlobalConfig.java, sdk/src/main/java/org/zstack/sdk/LogCategory.java, sdk/src/main/java/org/zstack/sdk/LogLevel.java, sdk/src/main/java/org/zstack/sdk/LogType.java, sdk/src/main/java/org/zstack/sdk/LogServerState.java, sdk/src/main/java/org/zstack/sdk/LogServerInventory.java
LogServerVO 表与注释被新增;新增全局配置 SYNC_CUSTOM_LOG_CONFIGURATION_TASK_INTERVAL(默认 30);新增枚举(LogCategory/LogLevel/LogType/LogServerState)与 LogServerInventory POJO。
新增日志服务器操作
sdk/src/main/java/org/zstack/sdk/AddLogServerAction.java, sdk/src/main/java/org/zstack/sdk/AddLogServerResult.java
实现 POST /log/servers 的 SDK 动作(参数、同步/异步 call、makeResult、结果容器 AddLogServerResult 包含 LogServerInventory)。
删除日志服务器操作
sdk/src/main/java/org/zstack/sdk/DeleteLogServerAction.java, sdk/src/main/java/org/zstack/sdk/DeleteLogServerResult.java
实现 DELETE /log/servers 的 SDK 动作(uuid 等参数、同步/异步 call、错误映射);新增空结果类 DeleteLogServerResult
更新日志服务器操作
sdk/src/main/java/org/zstack/sdk/UpdateLogServerAction.java, sdk/src/main/java/org/zstack/sdk/UpdateLogServerResult.java
实现 PUT /log/servers 的 SDK 动作(参数映射、makeResult、同步/异步 调用);新增结果类包含更新后的 LogServerInventory
查询日志服务器操作
sdk/src/main/java/org/zstack/sdk/QueryLogServerAction.java, sdk/src/main/java/org/zstack/sdk/QueryLogServerResult.java
实现 GET /log/servers 的 SDK 查询动作与分页结果结构(inventories、total)。
SDK 集成与类型映射
sdk/src/main/java/org/zstack/sdk/AddLogConfigurationAction.java, sdk/src/main/java/org/zstack/sdk/SourceClassMap.java, rest/src/main/resources/scripts/SdkDataStructureGenerator.groovy
为日志配置添加 level 参数约束;在 SourceClassMap 中添加五组日志相关类型的双向映射;生成器脚本设置 SourceClassMap.java 输出子路径为 org/zstack/sdk

🎯 3 (Moderate) | ⏱️ ~20 分钟

"🐰
我在林间跳跃写下新表,
枚举列队如星光排列,
行为按钮(增删改查)一应俱全,
小爪子敲出 SDK 融合的节拍,
让日志服务器稳稳落地。"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding SDK support for log server functionality, which aligns with the primary objective of the PR.
Description check ✅ Passed The description references the related issue (ZSV-12254) and mentions DBImpact and GlobalConfigImpact, which relate to changes made in the PR (schema changes and global configuration additions).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/zstackio/ZSV-12254@@3

Comment @coderabbitai help to get the list of available commands and usage tips.

@zstack-robot-2
Copy link
Copy Markdown
Collaborator

Comment from yaohua.wu:

Review: MR !10004 — ZSV-12254

Background

  • Jira: ZSV-12254 — 支持日志服务器 (Improvement, P0, 后端)
  • PRD: ZSphere/5.1.0/日志服务器优化PRD.md
  • 关键 Jira 评论:「当日志服务器所属用户被删除掉了,应当把这个 log server 资源转给 admin 用户。」
  • 本 MR 范围:zstack 基础仓 SDK + Schema + GlobalConfig。生成 LogServerVO 表、LogServer*Action SDK 类、LogCategory/LogType/LogLevel 枚举,并在 LogGlobalConfig 增加同步间隔配置。
  • 关联 MR
    • !7127 (zstack-utility) — install.sh 增加 fluent-bit 二进制安装
    • !14087 (premium) — log/server/ 业务实现 + externalservice/fluentbit/ 输出代理(有多处 Critical

P0 — Critical

无(重型实现都在 premium 侧)。

P1 — Warning

# File:Line Issue Fix
1 conf/db/zsv/V5.1.0__schema.sql:39-53 LogServerVO 表缺少 state 列;且 configurationtext NOT NULL,但其中可能存 ES/Loki 的明文 http_passwd,无加密、无脱敏 增加 state 列(enabled/disabled)以避免每次配置错误时只能整行删;密码字段考虑独立 column 加密存储(参考 KMSCredentialVO 模式)或至少在 LogServerInventory.valueOf 中脱敏返回
2 core/src/main/java/org/zstack/core/log/LogGlobalConfig.java:18 SYNC_CUSTOM_LOG_CONFIGURATION_TASK_INTERVAL 默认 30 秒、numberGreaterThan=1。配合 premium 侧 LogConfigurationManagerImpl.startSyncCustomLogConfigurationTask()cancel(true) 中断旧任务再起新任务,间隔 2 秒就足以引发 Log4j2 appender 重建的 race(详见 !14087 的 P1) 建议下限提升到 10 秒(numberGreaterThan=9),并在 description 提醒"过小间隔可能导致 appender 重建抖动"
3 utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java diff 显示 new_file: truediff: "",即新增了一个空 Java 文件(不是 GitLab API 截断 —— size=0),无 package/类声明,编译期会被忽略,但作为新增"占位文件"语义不明 要么删除该文件,要么补完类声明(如果是占位常量类)

P2 — Suggestion

# File:Line Issue Fix
1 sdk/.../AddLogServerAction.java:42 configurationmaxLength,SDK 透传到 API 后 premium 侧 APIAddLogServerMsg.configuration 也未限长 与 premium 侧同步加 maxLength = 8192
2 sdk/.../LogServerInventory.java 资源是 @OwnedByAccount 但 inventory 缺 accountUuid 字段(DescribedByApi 通常会带 ownerAccountUuid),admin 查 list 时无法识别归属 与其他 OwnedByAccount inventory 对齐
3 sdk/.../SdkDataStructureGenerator.groovy:74 新增 f.subPath = "org/zstack/sdk" 同时 SourceClassMap.java 路径从 sdk/src/main/java/SourceClassMap.java 移动到 sdk/src/main/java/org/zstack/sdk/SourceClassMap.java(diff 中是 renamed)。这是修一个长期路径错位的好改动 OK
4 sdk/.../AddLogConfigurationAction.java:37 新增可选 level 字段是兼容的,但 premium 侧 APIAddLogConfigurationMsg__example__ 仍把 setLevel 误写成 setType 两次(详见 !14087 P2) 联动修复

跨仓库一致性

  • ✅ SDK 中的 enum 值(Log4j2/FluentBit, ManagementNodeLog/PlatformOperationLog, 8 个 Log Level)与 premium 侧 APIAddLogServerMsg.@APIParam(validValues=...) 完全对齐。
  • LogServerVO schema 与 premium 侧 LogServerVO.java JPA 实体字段对齐(uuid/name/description/category/type/level/configuration/createDate/lastOpDate)。
  • ⚠️ Schema configurationNOT NULL,premium 侧 APIAddLogServerMsg.configuration 也是 required=true,OK;但 APIUpdateLogServerMsg 仅允许改 name/description 不允许改 configuration —— 这点 PRD 是否要求?
  • ⚠️ Premium 侧的 LogServerCascadeExtension 未实现 Jira 评论要求的"账户删除时转给 admin"(详见 !14087 P0 tao.yang/zstack-ZSV-3564@@2 #2);如果要做需要在 base 侧 schema 增加 accountUuid 字段或依赖 AccountResourceRefVO

Verdict: APPROVED with notes

本 MR 自身代码改动小、风险低(基本是 SDK 生成代码 + schema + config)。主要风险集中在 !14087,请同时关注那边的 P0 阻塞项。建议把上面的 Warning #1 schema 改造(state 列、密码脱敏)与 !14087 一并修订,避免 5.1.0 上线后出现升级痛点。


🤖 Robot Reviewer

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
sdk/src/main/java/org/zstack/sdk/QueryLogServerResult.java (1)

6-11: ⚡ Quick win

优化 SDK 返回类型:inventories 避免原始 List(需先确认生成/反序列化约定)
当前 inventories 为原始 java.util.List;但在本仓库 SDK 的大量 *Result 类中也使用同样的 raw List inventories(如 AddVRouterNetworksToOspfAreaResultGetZoneResult),疑似为生成器/序列化约定。建议先确认约定后再考虑在 QueryLogServerResult 中改为 List<具体清单类型> 并同步 setter/getter。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sdk/src/main/java/org/zstack/sdk/QueryLogServerResult.java` around lines 6 -
11, The field inventories in QueryLogServerResult is declared as a raw
java.util.List (with setInventories and getInventories) which risks
ClassCastExceptions and weak typing; confirm whether the SDK code
generator/serialization convention allows introducing generics, and if so change
the field to a typed List<YourInventoryType> and update
setInventories(java.util.List<YourInventoryType>) and getInventories() to return
List<YourInventoryType>, or otherwise document/annotate this class to indicate
why raw List is required to keep consistency with other Result classes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@conf/db/zsv/V5.1.0__schema.sql`:
- Line 51: Replace the illegal zero datetime default for the `createDate` column
by changing its DEFAULT from the literal '0000-00-00 00:00:00' to DEFAULT
CURRENT_TIMESTAMP; update the table/schema definition that contains the
`createDate` column so the column declaration reads with DEFAULT
CURRENT_TIMESTAMP to avoid strict-mode failures.

---

Nitpick comments:
In `@sdk/src/main/java/org/zstack/sdk/QueryLogServerResult.java`:
- Around line 6-11: The field inventories in QueryLogServerResult is declared as
a raw java.util.List (with setInventories and getInventories) which risks
ClassCastExceptions and weak typing; confirm whether the SDK code
generator/serialization convention allows introducing generics, and if so change
the field to a typed List<YourInventoryType> and update
setInventories(java.util.List<YourInventoryType>) and getInventories() to return
List<YourInventoryType>, or otherwise document/annotate this class to indicate
why raw List is required to keep consistency with other Result classes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3efb8186-136b-4427-996a-7d7657fe8946

📥 Commits

Reviewing files that changed from the base of the PR and between 8740fbd and 5929804.

⛔ Files ignored due to path filters (1)
  • conf/persistence.xml is excluded by !**/*.xml
📒 Files selected for processing (18)
  • conf/db/zsv/V5.1.0__schema.sql
  • core/src/main/java/org/zstack/core/log/LogGlobalConfig.java
  • rest/src/main/resources/scripts/SdkDataStructureGenerator.groovy
  • sdk/src/main/java/org/zstack/sdk/AddLogConfigurationAction.java
  • sdk/src/main/java/org/zstack/sdk/AddLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/AddLogServerResult.java
  • sdk/src/main/java/org/zstack/sdk/DeleteLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/DeleteLogServerResult.java
  • sdk/src/main/java/org/zstack/sdk/LogCategory.java
  • sdk/src/main/java/org/zstack/sdk/LogLevel.java
  • sdk/src/main/java/org/zstack/sdk/LogServerInventory.java
  • sdk/src/main/java/org/zstack/sdk/LogType.java
  • sdk/src/main/java/org/zstack/sdk/QueryLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/QueryLogServerResult.java
  • sdk/src/main/java/org/zstack/sdk/SourceClassMap.java
  • sdk/src/main/java/org/zstack/sdk/UpdateLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/UpdateLogServerResult.java
  • utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java

Comment thread conf/db/zsv/V5.1.0__schema.sql Outdated
@ZStack-Robot
Copy link
Copy Markdown
Collaborator Author

Comment from taiyue.chen:

转移这个功能之前已经实现了,只要不在cascade删除那边引入account这个edge,即可避免在account删除时,一起被删掉。然后,这些无主资源会被自动流转给admin用户。

@MatheMatrix MatheMatrix force-pushed the sync/zstackio/ZSV-12254@@3 branch 4 times, most recently from 19e0aae to 028c6b9 Compare May 27, 2026 12:48
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@conf/db/zsv/V5.1.0__schema.sql`:
- Line 50: The schema currently defines the `configuration` column as text NOT
NULL which stores full server configs in plaintext; change this by identifying
sensitive keys within `configuration` and either: (a) extract those keys into
dedicated columns (e.g., `api_key`, `password`, `token`) and store them
encrypted at rest (use your app's encryption service or DB encryption functions)
with appropriate NOT NULL/NULL constraints, or (b) keep a single `configuration`
column but ensure the application encrypts it before INSERT/UPDATE and decrypts
only when needed, plus add DB-level comments/constraints to enforce that
`configuration` is stored encrypted and ensure SELECTs used by Inventory/log
APIs strip or mask sensitive fields. Ensure the migration updates the table to
add new encrypted columns and a migration path to move and remove plaintext data
from the `configuration` text field.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 07aef937-c23f-4846-93db-f9cb8b362bd5

📥 Commits

Reviewing files that changed from the base of the PR and between 5c8fb87 and 028c6b9.

⛔ Files ignored due to path filters (1)
  • conf/persistence.xml is excluded by !**/*.xml
📒 Files selected for processing (18)
  • conf/db/zsv/V5.1.0__schema.sql
  • core/src/main/java/org/zstack/core/log/LogGlobalConfig.java
  • rest/src/main/resources/scripts/SdkDataStructureGenerator.groovy
  • sdk/src/main/java/org/zstack/sdk/AddLogConfigurationAction.java
  • sdk/src/main/java/org/zstack/sdk/AddLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/AddLogServerResult.java
  • sdk/src/main/java/org/zstack/sdk/DeleteLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/DeleteLogServerResult.java
  • sdk/src/main/java/org/zstack/sdk/LogCategory.java
  • sdk/src/main/java/org/zstack/sdk/LogLevel.java
  • sdk/src/main/java/org/zstack/sdk/LogServerInventory.java
  • sdk/src/main/java/org/zstack/sdk/LogServerState.java
  • sdk/src/main/java/org/zstack/sdk/LogType.java
  • sdk/src/main/java/org/zstack/sdk/QueryLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/QueryLogServerResult.java
  • sdk/src/main/java/org/zstack/sdk/SourceClassMap.java
  • sdk/src/main/java/org/zstack/sdk/UpdateLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/UpdateLogServerResult.java
✅ Files skipped from review due to trivial changes (2)
  • sdk/src/main/java/org/zstack/sdk/LogServerState.java
  • sdk/src/main/java/org/zstack/sdk/UpdateLogServerResult.java
🚧 Files skipped from review as they are similar to previous changes (12)
  • sdk/src/main/java/org/zstack/sdk/LogLevel.java
  • core/src/main/java/org/zstack/core/log/LogGlobalConfig.java
  • sdk/src/main/java/org/zstack/sdk/LogType.java
  • sdk/src/main/java/org/zstack/sdk/LogServerInventory.java
  • sdk/src/main/java/org/zstack/sdk/AddLogConfigurationAction.java
  • sdk/src/main/java/org/zstack/sdk/QueryLogServerResult.java
  • sdk/src/main/java/org/zstack/sdk/DeleteLogServerResult.java
  • sdk/src/main/java/org/zstack/sdk/QueryLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/AddLogServerAction.java
  • rest/src/main/resources/scripts/SdkDataStructureGenerator.groovy
  • sdk/src/main/java/org/zstack/sdk/UpdateLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/DeleteLogServerAction.java

`type` varchar(255) NOT NULL,
`level` varchar(255) NULL,
`state` varchar(255) NOT NULL DEFAULT 'Enabled',
`configuration` text NOT NULL,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

避免将敏感配置明文存储在 configuration 字段。

configuration 使用 text NOT NULL 会把日志服务器配置整体落库;若包含如密码/令牌等敏感项,将形成明文泄露面(备份、审计导出、SQL 日志)。建议将密钥类字段拆分为单独加密存储(或至少入库前加密、出参脱敏),并避免在 Inventory/日志中直接回传原文。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@conf/db/zsv/V5.1.0__schema.sql` at line 50, The schema currently defines the
`configuration` column as text NOT NULL which stores full server configs in
plaintext; change this by identifying sensitive keys within `configuration` and
either: (a) extract those keys into dedicated columns (e.g., `api_key`,
`password`, `token`) and store them encrypted at rest (use your app's encryption
service or DB encryption functions) with appropriate NOT NULL/NULL constraints,
or (b) keep a single `configuration` column but ensure the application encrypts
it before INSERT/UPDATE and decrypts only when needed, plus add DB-level
comments/constraints to enforce that `configuration` is stored encrypted and
ensure SELECTs used by Inventory/log APIs strip or mask sensitive fields. Ensure
the migration updates the table to add new encrypted columns and a migration
path to move and remove plaintext data from the `configuration` text field.

DBImpact
GlobalConfigImpact

Resolves: ZSV-12254

Change-Id: I77716165756971736379716977626b6f6f65656e
@MatheMatrix MatheMatrix force-pushed the sync/zstackio/ZSV-12254@@3 branch from 028c6b9 to 7929805 Compare May 27, 2026 14:58
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@sdk/src/main/java/org/zstack/sdk/LogType.java`:
- Around line 4-5: The enum constants Log4j2 and FluentBit in the LogType enum
violate the all-caps underscore convention; rename them to LOG4J2 and FLUENT_BIT
in the org.zstack.sdk.LogType enum (update any references to LogType.Log4j2 and
LogType.FluentBit accordingly) and, if these enum names are used for
serialization or mapped by name to the server, coordinate/verify compatibility
with the server-side enum or add a custom serializer/annotation to preserve
external names before changing; ensure tests and usages are updated to the new
identifiers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e809a433-0915-48d2-be48-e5e85c6a7153

📥 Commits

Reviewing files that changed from the base of the PR and between 028c6b9 and 7929805.

⛔ Files ignored due to path filters (1)
  • conf/persistence.xml is excluded by !**/*.xml
📒 Files selected for processing (18)
  • conf/db/zsv/V5.1.0__schema.sql
  • core/src/main/java/org/zstack/core/log/LogGlobalConfig.java
  • rest/src/main/resources/scripts/SdkDataStructureGenerator.groovy
  • sdk/src/main/java/org/zstack/sdk/AddLogConfigurationAction.java
  • sdk/src/main/java/org/zstack/sdk/AddLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/AddLogServerResult.java
  • sdk/src/main/java/org/zstack/sdk/DeleteLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/DeleteLogServerResult.java
  • sdk/src/main/java/org/zstack/sdk/LogCategory.java
  • sdk/src/main/java/org/zstack/sdk/LogLevel.java
  • sdk/src/main/java/org/zstack/sdk/LogServerInventory.java
  • sdk/src/main/java/org/zstack/sdk/LogServerState.java
  • sdk/src/main/java/org/zstack/sdk/LogType.java
  • sdk/src/main/java/org/zstack/sdk/QueryLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/QueryLogServerResult.java
  • sdk/src/main/java/org/zstack/sdk/SourceClassMap.java
  • sdk/src/main/java/org/zstack/sdk/UpdateLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/UpdateLogServerResult.java
✅ Files skipped from review due to trivial changes (1)
  • sdk/src/main/java/org/zstack/sdk/LogServerInventory.java
🚧 Files skipped from review as they are similar to previous changes (16)
  • sdk/src/main/java/org/zstack/sdk/LogLevel.java
  • rest/src/main/resources/scripts/SdkDataStructureGenerator.groovy
  • sdk/src/main/java/org/zstack/sdk/DeleteLogServerResult.java
  • sdk/src/main/java/org/zstack/sdk/AddLogConfigurationAction.java
  • sdk/src/main/java/org/zstack/sdk/LogCategory.java
  • sdk/src/main/java/org/zstack/sdk/SourceClassMap.java
  • sdk/src/main/java/org/zstack/sdk/QueryLogServerResult.java
  • core/src/main/java/org/zstack/core/log/LogGlobalConfig.java
  • sdk/src/main/java/org/zstack/sdk/AddLogServerResult.java
  • conf/db/zsv/V5.1.0__schema.sql
  • sdk/src/main/java/org/zstack/sdk/AddLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/UpdateLogServerResult.java
  • sdk/src/main/java/org/zstack/sdk/DeleteLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/UpdateLogServerAction.java
  • sdk/src/main/java/org/zstack/sdk/LogServerState.java
  • sdk/src/main/java/org/zstack/sdk/QueryLogServerAction.java

Comment on lines +4 to +5
Log4j2,
FluentBit,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

枚举常量命名不符合规范,建议与服务端枚举一起统一。

Line 4 和 Line 5 的 Log4j2FluentBit 不符合常量全大写下划线命名规则。若这些值参与 SDK/服务端按名称映射,请同步评估服务端枚举与序列化兼容性后再统一重命名。

♻️ 建议修改
 public enum LogType {
-	Log4j2,
-	FluentBit,
+	LOG4J2,
+	FLUENT_BIT,
 }

As per coding guidelines “常量命名:全部大写,使用下划线分隔单词。”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sdk/src/main/java/org/zstack/sdk/LogType.java` around lines 4 - 5, The enum
constants Log4j2 and FluentBit in the LogType enum violate the all-caps
underscore convention; rename them to LOG4J2 and FLUENT_BIT in the
org.zstack.sdk.LogType enum (update any references to LogType.Log4j2 and
LogType.FluentBit accordingly) and, if these enum names are used for
serialization or mapped by name to the server, coordinate/verify compatibility
with the server-side enum or add a custom serializer/annotation to preserve
external names before changing; ensure tests and usages are updated to the new
identifiers.

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