apache / apache/rocketmq-dashboard

[Studio][UX] Clarify native alert aggregation window retention behavior

Open
#4,157 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
683
Avg merge
2d 14h
Merged PRs (30d)
58

Description

## Problem

Studio-native alert aggregation reads historical samples from `MetricSnapshotRepository.findRecent(...)` using `windowSeconds`, while `CollectorScheduler` deletes samples older than the configured `studio.alerting.snapshot-retention` (default `PT24H`). Alert rule create and update currently validate only that `windowSeconds` is non-negative.

A native rule can therefore request a window longer than the retained history. For example, a 48-hour AVG rule with the default 24-hour retention is accepted but is silently evaluated from an incomplete sample set, which can produce misleading thresholds and alerts.

## Expected behavior

- When `snapshot-retention` is positive, native alert rules must reject `windowSeconds` values longer than the configured retention.
- A window equal to the retention remains valid.
- `windowSeconds=0` keeps the current single-sample behavior.
- Non-native Prometheus rules are not constrained by the native snapshot store.
- Non-positive retention keeps the existing cleanup-disabled behavior and does not impose a window cap.
- Create, update, and import use the same write-path validation.

## Acceptance criteria

- Reject an oversized native window with HTTP/business code 400 before repository mutation.
- Apply the same check to create and update.
- Add focused coverage for oversized, equal-boundary, non-native, and cleanup-disabled cases.
- Do not change snapshot collection, retention cleanup, or aggregation math.

## Scope

This change validates writes against the currently configured retention. Migration or runtime reporting for rules created under an older, longer retention configuration is separate operational work.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the native alert rule create, update, and import write paths and their existing non-negative windowSeconds validation. Read how MetricSnapshotRepository.findRecent(...) uses the window and how CollectorScheduler applies snapshot-retention. Done means oversized native windows are rejected before mutation, while equal-boundary, zero, non-native, and non-positive-retention cases remain valid and are covered by focused tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.