Skip to content

<fix>[zwatch]: allow alarm labels sharing a key#4409

Closed
zstack-robot-2 wants to merge 1 commit into
5.5.28from
sync/yaohua.wu/bugfix/ZSTAC-86538@@2
Closed

<fix>[zwatch]: allow alarm labels sharing a key#4409
zstack-robot-2 wants to merge 1 commit into
5.5.28from
sync/yaohua.wu/bugfix/ZSTAC-86538@@2

Conversation

@zstack-robot-2

Copy link
Copy Markdown
Collaborator

ZSTAC-86538

Root Cause

Alarm labels were constrained by alarm UUID and key in the database,
while the API error code already describes duplicates by key,
operator, and value. This blocked valid alarm filters that reuse the
same field with a different operator or value.

Changes

Module Change
conf/db Replace unique alarm label key index with a non-unique lookup index.
conf/i18n Align duplicate label error-code placeholders with the full tuple.

Test

  • mvn -o -P premium -pl premium/zwatch -am -DskipTests compile passed.
  • git diff --check passed in zstack and premium worktrees.
  • jq empty passed for modified i18n JSON files.
  • mvn -o -P premium -pl premium/test-premium -am -Dtest=AlarmApiCase -Dclean ... test was blocked before test execution by local MN startup: TransactionRequiredException in GlobalConfigFacadeImpl; Tests run: 0.

Related MRs

  • premium MR: pending

Related: ZSTAC-86538

sync from gitlab !10369

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 23 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ab44b60e-4f93-43a3-97a6-511e4361c475

📥 Commits

Reviewing files that changed from the base of the PR and between 69c94de and 5a14563.

⛔ Files ignored due to path filters (9)
  • conf/i18n.json is excluded by !**/*.json
  • conf/i18n/globalErrorCodeMapping/global-error-de-DE.json is excluded by !**/*.json
  • conf/i18n/globalErrorCodeMapping/global-error-en_US.json is excluded by !**/*.json
  • conf/i18n/globalErrorCodeMapping/global-error-fr-FR.json is excluded by !**/*.json
  • conf/i18n/globalErrorCodeMapping/global-error-id-ID.json is excluded by !**/*.json
  • conf/i18n/globalErrorCodeMapping/global-error-ja-JP.json is excluded by !**/*.json
  • conf/i18n/globalErrorCodeMapping/global-error-ko-KR.json is excluded by !**/*.json
  • conf/i18n/globalErrorCodeMapping/global-error-ru-RU.json is excluded by !**/*.json
  • conf/i18n/globalErrorCodeMapping/global-error-th-TH.json is excluded by !**/*.json
📒 Files selected for processing (2)
  • conf/db/upgrade/V5.5.28__schema.sql
  • conf/i18n/messages_zh_CN.properties

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Could not fetch remote config from http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml: TimeoutError: The operation was aborted due to timeout
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/yaohua.wu/bugfix/ZSTAC-86538@@2

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

@MatheMatrix

Copy link
Copy Markdown
Owner

Comment from yaohua.wu:

Review: MR !10369 — ZSTAC-86538

Background

  • Jira: ZSTAC-86538 — 资源报警器指定磁盘后无法同时配置同字段过滤规则
  • Bug summary: Alarm labels were unique by (alarmUuid,key), so a resource alarm could not keep a selected disk label and add another filter with the same key.
  • Intent & scope: Relax label uniqueness to exact label tuples while preserving duplicate rejection and keeping i18n mappings aligned.

Findings

Severity Result
P0 None
P1 None
P2 None

Coverage

  • Reviewed local diff against upstream/5.5.28 after fetching latest target branch.
  • Checked DB migration order and existing AlarmLabelVO.value column type.
  • Checked i18n placeholder count consistency across modified mappings.
  • Residual risk: exact duplicate labels are guarded at API level because DB cannot index full text value reliably.

Test

  • mvn -o -P premium -pl premium/zwatch -am -DskipTests compile passed.
  • git diff --check passed in zstack and premium worktrees.
  • jq empty passed for modified i18n JSON files.
  • AlarmApiCase did not execute locally: MN startup failed before tests with TransactionRequiredException in GlobalConfigFacadeImpl; Tests run: 0.

Verdict: APPROVED

No blocking findings in the reviewed diff.

1. Why?
Alarm labels were unique by alarm UUID and key, which blocked
valid filters using the same field with different operators or values.

2. How?
Relax the database constraint to a non-unique lookup index and keep
error-code parameter mappings aligned with the full label tuple.

3. Side effects?
Exact duplicate protection is handled in the zwatch API layer.

# Summary of changes (by module):
- conf/db: replace unique alarm label key index with lookup index
- conf/i18n: align duplicate label error-code placeholders

Related: ZSTAC-86538
Change-Id: I89c866ef6e763e1eac956f9573dd40ce0d81cb06
@MatheMatrix MatheMatrix force-pushed the sync/yaohua.wu/bugfix/ZSTAC-86538@@2 branch from 1b5c2fa to 5a14563 Compare July 2, 2026 03:51
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.

3 participants