Skip to content

[ISSUE #14833] Add AI resource trace logging and fix prompt bizTags handling in both UIs - #14852

Merged
KomachiSion merged 3 commits into
alibaba:developfrom
saynoword:add-trace-log-for-ai
Apr 3, 2026
Merged

KomachiSion merged 3 commits into
alibaba:developfrom
saynoword:add-trace-log-for-ai

Conversation

@saynoword

Copy link
Copy Markdown
Contributor

Please do not create a Pull Request without creating an issue first.

What is the purpose of the change

Add a dedicated JSON-formatted audit trace log (ai_resource_trace.log) for all AI resource lifecycle operations (skill, agentspec, prompt, mcp, a2a), designed for ELK/Loki integration. Additionally, fix prompt bizTags handling throughout the stack — backend model
type was mismatched with actual storage format, causing silent failures in both legacy and new console UIs.

Brief changelog

  • Add AiResourceTraceService with operation constants and JSON log methods, AiLogUtil with dedicated logger, and VisibilityHelper.resolveClientIp() for IP extraction.
  • Integrate trace logs across all AI resource services: Skill, AgentSpec, Prompt, McpServer, A2aServer, and AiResourceManager (covering create, update, delete, publish, review, online/offline, labels, scope, enable/disable).
  • Configure RollingFileAppender in nacos-logback.xml (1GB maxFileSize, 15 days retention).
  • Fix PromptMetaSummary.bizTags from List<String> to String to match actual storage format, remove broken JSON deserialization in read/write paths.
  • Add OP_UPDATE_DESCRIPTION constant and trace logging for changeOnlineStatus, updateLabels, updateDescription operations that were previously missing.
  • Fix legacy UI: prompt list page now displays label keys instead of broken bizTags; add inline bizTags editing in prompt detail page.
  • Fix new UI: correct bizTags TypeScript type from string[] to string, add parseBizTags() utility, update PromptCard, PromptDetailPage, and related tests.

Verifying this change

  • Backend static checks:

    mvn -B clean package apache-rat:check spotbugs:check -DskipTests
    
  • Unit tests:
    mvn clean install -DskipITs

  • Manual verification:

    • Perform prompt label update, online/offline toggle, description update — confirm JSON trace entries appear in ai_resource_trace.log.
    • Legacy UI: prompt list shows label keys correctly; prompt detail page supports inline bizTags editing.
    • New UI: prompt card and detail page display bizTags correctly after parseBizTags() fix.

Follow this checklist to help us incorporate your contribution quickly and easily:

[ ] Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
[ ] Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
[ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
[ ] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module https://github.
com/alibaba/nacos/tree/master/test.
[ ] Run mvn -B clean package apache-rat:check spotbugs:check -DskipTests to make sure basic checks pass. Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.

Add ai_resource_trace.log with JSON-formatted entries for auditing all
AI resource version lifecycle operations across skill, agentspec, prompt,
mcp, and a2a resource types. Designed for ELK/Loki integration with
ISO 8601 timestamps.

- Add AiResourceTraceService with operation constants and JSON log methods
- Add AiLogUtil with dedicated logger routed to ai-resource-trace.log
- Add VisibilityHelper.resolveClientIp() for request context IP extraction
- Integrate trace logs in SkillOperationServiceImpl (upload, createDraft,
  updateDraft, deleteDraft, updateBizTags)
- Integrate trace logs in AgentSpecOperationServiceImpl (upload, createDraft,
  updateDraft, deleteDraft, updateBizTags)
- Integrate trace logs in PromptOperationServiceImpl (createDraft,
  updateDraft, deleteDraft, updateBizTags)
- Integrate trace logs in AiResourceManager (publish, forcePublish,
  submitReview, reviewApproved, reviewRejected, onlineVersion,
  offlineVersion, deleteResource, updateLabels, updateScope, enable,
  disable)
- Integrate trace logs in McpServerOperationService (create, update,
  delete)
- Integrate trace logs in A2aServerOperationService (register, update,
  delete)
- Configure RollingFileAppender in nacos-logback.xml (1GB maxFileSize,
  15 days retention)

🤖 Generated with [Qoder][https://qoder.com]
…roughout

- Change PromptMetaSummary.bizTags from List<String> to String to match Skill model
- Remove JSON serialization/deserialization of bizTags in read and write paths
- Remove parseBizTags() conversion in PromptAdminController, pass raw string directly
- Update legacy method signatures in PromptOperationService/Impl to accept String bizTags

This fixes bizTags not persisting after update: the read path was trying to
deserialize a plain string as a JSON array, causing silent failure. Now bizTags
is treated as an opaque string throughout the prompt layer, consistent with how
Skill handles it.

Assisted-by: Qoder
…ags handling

- Add OP_UPDATE_DESCRIPTION constant to AiResourceTraceService
- Add trace logging for changeOnlineStatus, updateLabels, updateDescription
- Change legacy UI prompt list column from bizTags to labels display
- Add inline bizTags editing support in legacy UI prompt detail page
- Fix new UI bizTags type from string[] to string, add parseBizTags() utility
- Update new UI PromptCard, PromptDetailPage, and tests to use parseBizTags()

🤖 Generated with [Qoder][https://qoder.com]
@github-actions

github-actions Bot commented Apr 3, 2026

Copy link
Copy Markdown

Thanks for your this PR. 🙏
Please check again for your PR changes whether contains any usage/api/configuration change such as Add new API , Add new configuration, Change default value of configuration.
If so, please add or update documents(markdown type) in docs/next/ for repository nacos-group/nacos-group.github.io


感谢您提交的PR。 🙏
请再次查看您的PR内容,确认是否包含任何使用方式/API/配置参数的变更,如:新增API、新增配置参数、修改默认配置等操作。
如果是,请确保在提交之前,在仓库nacos-group/nacos-group.github.io中的docs/next/目录下添加或更新文档(markdown格式)。

@KomachiSion
KomachiSion merged commit e52214f into alibaba:develop Apr 3, 2026
3 checks passed
@KomachiSion KomachiSion added the kind/feature type/feature label Apr 3, 2026
@KomachiSion KomachiSion added this to the 3.2.1 milestone Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature type/feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants