Skip to content

Commit 681cc3e

Browse files
committed
fix docs and UT
1 parent 384cbb9 commit 681cc3e

File tree

16 files changed

+47
-47
lines changed

16 files changed

+47
-47
lines changed

docs/en/api/metrics-query-expression.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,17 +495,17 @@ metric{label1='a', label2='2a'}
495495
```
496496

497497
### Baseline Operation
498-
Baseline Operation takes an expression and gets the baseline predict values of the input metric.
498+
Baseline Operation takes an expression and gets the baseline predicted values of the input metric.
499499

500500
Expression:
501501
```text
502502
baseline(Expression, <baseline_type>)
503503
```
504504

505-
- `baseline_type` is the type of the baseline predict value. The type can be `value`, `upper`, `lower`.
505+
- `baseline_type` is the type of the baseline predicted value. The type can be `value`, `upper`, `lower`.
506506

507507
for example:
508-
If we want to get the baseline predict `upper` values of the `service_resp_time` metric, we can use the following expression:
508+
If we want to get the baseline predicted `upper` values of the `service_resp_time` metric, we can use the following expression:
509509
```text
510510
baseline(service_resp_time, upper)
511511
```
@@ -515,7 +515,7 @@ baseline(service_resp_time, upper)
515515
Otherwise, the result will be empty.
516516
- The baseline operation is only supported by the metrics that support the baseline data, which defined in the baseline service.
517517
If the metric not supported or has no baseline data, the result will be empty.
518-
- For now, the time bucket step of the predict value is `HOUR`.
518+
- For now, the time bucket step of the predicted value is `HOUR`.
519519
And the metric values provided within this baseline are at a minute-level granularity.
520520
For example, it includes metrics such as the number of visits per minute. So if the query step is `MINUTE` and duration is in a same hour, the returned value will be same in every minute.
521521

docs/en/setup/backend/backend-alarm.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,19 @@ Currently, metrics from the **Service**, **Service Instance**, **Endpoint**, **S
125125

126126
Submit an issue or a pull request if you want to support any other scopes in Alarm.
127127

128-
### Use the Baseline Predict Value to trigger the Alarm
129-
Since 10.2.0, SkyWalking supports using the baseline predict value in the alarm rule expression.
128+
### Use the Baseline Predicted Value to trigger the Alarm
129+
Since 10.2.0, SkyWalking supports using the baseline predicted value in the alarm rule expression.
130130
The MQE expression can refer to [Baseline Operation](../../api/metrics-query-expression.md#baseline-operation).
131131

132-
For example, the following rule will compare the service response time with the baseline predict value in each time bucket, and
133-
when the service response time is higher than the baseline predict value in 3 minutes of the last 10 minutes, the alarm will be triggered.
132+
For example, the following rule will compare the service response time with the baseline predicted value in each time bucket, and
133+
when the service response time is higher than the baseline predicted value in 3 minutes of the last 10 minutes, the alarm will be triggered.
134134

135135
```yaml
136136
rules:
137137
service_resp_time_rule:
138138
expression: sum(service_resp_time > baseline(service_resp_time, upper)) > 3
139139
period: 10
140-
message: Service {name} response time is higher than the baseline predict value in 3 minutes of last 10 minutes.
140+
message: Service {name} response time is higher than the baseline predicted value in 3 minutes of last 10 minutes.
141141
```
142142

143143
## Hooks

oap-server/metrics-baseline/src/main/java/org/apache/skywalking/oap/server/baseline/service/BaselineQueryService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ public interface BaselineQueryService extends Service {
3232
List<String> querySupportedMetrics();
3333

3434
/**
35-
* query predict metrics
35+
* query predicted metrics
3636
*/
3737
List<PredictServiceMetrics> queryPredictMetrics(List<ServiceMetrics> serviceMetrics,
3838
long startTimeBucket,
3939
long endTimeBucket);
4040

4141
/**
42-
* query predict metrics from cache, return all predict metrics for the given service name and time bucket hour
42+
* query predicted metrics from cache, return all predicted metrics for the given service name and time bucket hour
4343
*/
4444
Map<String, PredictServiceMetrics.PredictMetricsValue> queryPredictMetricsFromCache(String serviceName, String timeBucketHour);
4545
}

oap-server/mqe-rt/src/main/java/org/apache/skywalking/mqe/rt/MQEVisitorBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ private long getValueByType(PredictServiceMetrics.PredictSingleValue predictSing
618618
case MQEParser.LOWER:
619619
return predictSingleValue.getLowerValue();
620620
default:
621-
throw new IllegalArgumentException("Unsupported predict value type: " + valueType);
621+
throw new IllegalArgumentException("Unsupported predicted value type: " + valueType);
622622
}
623623
}
624624

oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmCoreTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void testTriggerTimePoint() throws InterruptedException {
4949

5050
Rules emptyRules = new Rules();
5151
emptyRules.setRules(new ArrayList<>(0));
52-
AlarmCore core = new AlarmCore(new AlarmRulesWatcher(emptyRules, null));
52+
AlarmCore core = new AlarmCore(new AlarmRulesWatcher(emptyRules, null, null));
5353

5454
Map<String, List<RunningRule>> runningContext = Whitebox.getInternalState(core, "runningContext");
5555

oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmRuleTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void setUp() throws NoSuchFieldException, IllegalAccessException {
6060

6161
@Test
6262
public void testExpressionVerify() throws IllegalExpressionException {
63-
AlarmRule rule = new AlarmRule();
63+
AlarmRule rule = new AlarmRule(null);
6464
//normal common metric
6565
rule.setExpression("sum(service_percent < 85) >= 3");
6666
//normal labeled metric

oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/NotifyHandlerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public void setUp() {
259259

260260
ModuleManager moduleManager = mock(ModuleManager.class);
261261

262-
notifyHandler = new NotifyHandler(new AlarmRulesWatcher(rules, null), moduleManager);
262+
notifyHandler = new NotifyHandler(new AlarmRulesWatcher(rules, null, moduleManager), moduleManager);
263263

264264
notifyHandler.init(alarmMessageList -> {
265265
for (AlarmMessage message : alarmMessageList) {

oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRuleTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void setup() {
6868

6969
@Test
7070
public void testInitAndStart() throws IllegalExpressionException {
71-
AlarmRule alarmRule = new AlarmRule();
71+
AlarmRule alarmRule = new AlarmRule(null);
7272
alarmRule.setAlarmRuleName("mix_rule");
7373
alarmRule.setExpression("sum((increase(endpoint_cpm,5) + increase(endpoint_percent,2)) > 0) >= 1");
7474
alarmRule.getIncludeMetrics().add("endpoint_percent");
@@ -77,7 +77,7 @@ public void testInitAndStart() throws IllegalExpressionException {
7777
alarmRule.setTags(new HashMap<String, String>() {{
7878
put("key", "value");
7979
}});
80-
RunningRule runningRule = new RunningRule(alarmRule);
80+
RunningRule runningRule = new RunningRule(alarmRule, null);
8181

8282
DateTime startTime = DateTime.now();
8383
long timeInPeriod1 = TimeBucket.getMinuteTimeBucket(startTime.getMillis());
@@ -99,7 +99,7 @@ public void testInitAndStart() throws IllegalExpressionException {
9999

100100
@Test
101101
public void testAlarm() throws IllegalExpressionException {
102-
AlarmRule alarmRule = new AlarmRule();
102+
AlarmRule alarmRule = new AlarmRule(null);
103103
alarmRule.setAlarmRuleName("endpoint_percent_rule");
104104
alarmRule.setExpression("sum(endpoint_percent < 75) >= 3");
105105
alarmRule.getIncludeMetrics().add("endpoint_percent");
@@ -108,7 +108,7 @@ public void testAlarm() throws IllegalExpressionException {
108108
alarmRule.setTags(new HashMap<String, String>() {{
109109
put("key", "value");
110110
}});
111-
RunningRule runningRule = new RunningRule(alarmRule);
111+
RunningRule runningRule = new RunningRule(alarmRule, null);
112112

113113
DateTime startTime = DateTime.now();
114114
long timeInPeriod1 = TimeBucket.getMinuteTimeBucket(startTime.minusMinutes(6).getMillis());
@@ -130,7 +130,7 @@ public void testAlarm() throws IllegalExpressionException {
130130

131131
@Test
132132
public void testAlarmMetricsOutOfDate() throws IllegalExpressionException {
133-
AlarmRule alarmRule = new AlarmRule();
133+
AlarmRule alarmRule = new AlarmRule(null);
134134
alarmRule.setAlarmRuleName("endpoint_percent_rule");
135135
alarmRule.setExpression("sum(endpoint_percent < 75) >= 3");
136136
alarmRule.getIncludeMetrics().add("endpoint_percent");
@@ -139,7 +139,7 @@ public void testAlarmMetricsOutOfDate() throws IllegalExpressionException {
139139
alarmRule.setTags(new HashMap<String, String>() {{
140140
put("key", "value");
141141
}});
142-
RunningRule runningRule = new RunningRule(alarmRule);
142+
RunningRule runningRule = new RunningRule(alarmRule, null);
143143

144144
DateTime startTime = DateTime.now();
145145
long timeInPeriod1 = TimeBucket.getMinuteTimeBucket(startTime.minusMinutes(153).getMillis());
@@ -160,7 +160,7 @@ public void testAlarmMetricsOutOfDate() throws IllegalExpressionException {
160160
public void testLabeledAlarm() throws IllegalExpressionException {
161161
ValueColumnMetadata.INSTANCE.putIfAbsent(
162162
"endpoint_labeled", "testColumn", Column.ValueDataType.LABELED_VALUE, 0, Scope.Endpoint.getScopeId());
163-
AlarmRule alarmRule = new AlarmRule();
163+
AlarmRule alarmRule = new AlarmRule(null);
164164
alarmRule.setExpression("sum(endpoint_labeled{p='95,99'} > 10) >= 3");
165165
alarmRule.getIncludeMetrics().add("endpoint_labeled");
166166
assertLabeled(alarmRule, "{p=50},17|{p=99},11", "{p=75},15|{p=95},12|{p=99},12", "{p=90},1|{p=99},20", 1);
@@ -181,7 +181,7 @@ public void testMultipleMetricsNoAlarm() throws IllegalExpressionException {
181181
}
182182

183183
private void multipleMetricsAlarm(String expression, int alarmMsgSize) throws IllegalExpressionException {
184-
AlarmRule alarmRule = new AlarmRule();
184+
AlarmRule alarmRule = new AlarmRule(null);
185185
alarmRule.setAlarmRuleName("endpoint_percent_rule");
186186
alarmRule.setExpression(expression);
187187
alarmRule.getIncludeMetrics().add("endpoint_percent");
@@ -191,7 +191,7 @@ private void multipleMetricsAlarm(String expression, int alarmMsgSize) throws Il
191191
alarmRule.setTags(new HashMap<String, String>() {{
192192
put("key", "value");
193193
}});
194-
RunningRule runningRule = new RunningRule(alarmRule);
194+
RunningRule runningRule = new RunningRule(alarmRule, null);
195195
DateTime startTime = DateTime.now();
196196
long timeInPeriod1 = TimeBucket.getMinuteTimeBucket(startTime.minusMinutes(6).getMillis());
197197
long timeInPeriod2 = TimeBucket.getMinuteTimeBucket(startTime.minusMinutes(4).getMillis());
@@ -214,7 +214,7 @@ private void multipleMetricsAlarm(String expression, int alarmMsgSize) throws Il
214214

215215
@Test
216216
public void testNoAlarm() throws IllegalExpressionException {
217-
AlarmRule alarmRule = new AlarmRule();
217+
AlarmRule alarmRule = new AlarmRule(null);
218218
alarmRule.setAlarmRuleName("endpoint_percent_rule");
219219
alarmRule.setExpression("sum(endpoint_percent > 75) >= 3");
220220
alarmRule.getIncludeMetrics().add("endpoint_percent");
@@ -223,7 +223,7 @@ public void testNoAlarm() throws IllegalExpressionException {
223223
alarmRule.setTags(new HashMap<String, String>() {{
224224
put("key", "value");
225225
}});
226-
RunningRule runningRule = new RunningRule(alarmRule);
226+
RunningRule runningRule = new RunningRule(alarmRule, null);
227227

228228
final boolean[] isAlarm = {false};
229229
AlarmCallback assertCallback = new AlarmCallback() {
@@ -262,7 +262,7 @@ public void doAlarm(List<AlarmMessage> alarmMessage) {
262262

263263
@Test
264264
public void testSilence() throws IllegalExpressionException {
265-
AlarmRule alarmRule = new AlarmRule();
265+
AlarmRule alarmRule = new AlarmRule(null);
266266
alarmRule.setAlarmRuleName("endpoint_percent_rule");
267267
alarmRule.setExpression("sum(endpoint_percent < 75) >= 3");
268268
alarmRule.getIncludeMetrics().add("endpoint_percent");
@@ -271,7 +271,7 @@ public void testSilence() throws IllegalExpressionException {
271271
alarmRule.setTags(new HashMap<String, String>() {{
272272
put("key", "value");
273273
}});
274-
RunningRule runningRule = new RunningRule(alarmRule);
274+
RunningRule runningRule = new RunningRule(alarmRule, null);
275275

276276
DateTime startTime = DateTime.now();
277277
long timeInPeriod1 = TimeBucket.getMinuteTimeBucket(startTime.minusMinutes(6).getMillis());
@@ -301,7 +301,7 @@ public void testSilence() throws IllegalExpressionException {
301301

302302
@Test
303303
public void testExclude() throws IllegalExpressionException {
304-
AlarmRule alarmRule = new AlarmRule();
304+
AlarmRule alarmRule = new AlarmRule(null);
305305
alarmRule.setAlarmRuleName("endpoint_percent_rule");
306306
alarmRule.setExpression("sum(endpoint_percent < 75) >= 3");
307307
alarmRule.getIncludeMetrics().add("endpoint_percent");
@@ -311,7 +311,7 @@ public void testExclude() throws IllegalExpressionException {
311311
alarmRule.setTags(new HashMap<String, String>() {{
312312
put("key", "value");
313313
}});
314-
RunningRule runningRule = new RunningRule(alarmRule);
314+
RunningRule runningRule = new RunningRule(alarmRule, null);
315315

316316
DateTime startTime = DateTime.now();
317317
long timeInPeriod1 = TimeBucket.getMinuteTimeBucket(startTime.minusMinutes(6).getMillis());
@@ -336,7 +336,7 @@ public void testExclude() throws IllegalExpressionException {
336336

337337
@Test
338338
public void testIncludeNamesRegex() throws IllegalExpressionException {
339-
AlarmRule alarmRule = new AlarmRule();
339+
AlarmRule alarmRule = new AlarmRule(null);
340340
alarmRule.setAlarmRuleName("endpoint_percent_rule");
341341
alarmRule.setExpression("sum(endpoint_percent < 1000) >= 1");
342342
alarmRule.getIncludeMetrics().add("endpoint_percent");
@@ -347,7 +347,7 @@ public void testIncludeNamesRegex() throws IllegalExpressionException {
347347
alarmRule.setTags(new HashMap<String, String>() {{
348348
put("key", "value");
349349
}});
350-
RunningRule runningRule = new RunningRule(alarmRule);
350+
RunningRule runningRule = new RunningRule(alarmRule, null);
351351

352352
DateTime startTime = DateTime.now();
353353
long timeInPeriod1 = TimeBucket.getMinuteTimeBucket(startTime.minusMinutes(6).getMillis());
@@ -372,7 +372,7 @@ public void testIncludeNamesRegex() throws IllegalExpressionException {
372372

373373
@Test
374374
public void testExcludeNamesRegex() throws IllegalExpressionException {
375-
AlarmRule alarmRule = new AlarmRule();
375+
AlarmRule alarmRule = new AlarmRule(null);
376376
alarmRule.setAlarmRuleName("endpoint_percent_rule");
377377
alarmRule.setExpression("sum(endpoint_percent < 1000) >= 1");
378378
alarmRule.getIncludeMetrics().add("endpoint_percent");
@@ -383,7 +383,7 @@ public void testExcludeNamesRegex() throws IllegalExpressionException {
383383
alarmRule.setTags(new HashMap<String, String>() {{
384384
put("key", "value");
385385
}});
386-
RunningRule runningRule = new RunningRule(alarmRule);
386+
RunningRule runningRule = new RunningRule(alarmRule, null);
387387

388388
DateTime startTime = DateTime.now();
389389
long timeInPeriod1 = TimeBucket.getMinuteTimeBucket(startTime.minusMinutes(6).getMillis());
@@ -583,7 +583,7 @@ private void assertLabeled(AlarmRule alarmRule, String value1, String value2, St
583583
alarmRule.setTags(new HashMap<String, String>() {{
584584
put("key", "value");
585585
}});
586-
RunningRule runningRule = new RunningRule(alarmRule);
586+
RunningRule runningRule = new RunningRule(alarmRule, null);
587587

588588
DateTime startTime = DateTime.now();
589589
long timeInPeriod1 = TimeBucket.getMinuteTimeBucket(startTime.minusMinutes(6).getMillis());

oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/dingtalk/DingtalkHookCallbackTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public void testDingtalkWebhookWithoutSign() throws Exception {
9090
rules.getDingtalkSettingsMap().put(setting1.getFormattedName(), setting1);
9191
rules.getDingtalkSettingsMap().put(setting2.getFormattedName(), setting2);
9292

93-
AlarmRulesWatcher alarmRulesWatcher = new AlarmRulesWatcher(rules, null);
93+
AlarmRulesWatcher alarmRulesWatcher = new AlarmRulesWatcher(rules, null, null);
9494
DingtalkHookCallback dingtalkCallBack = new DingtalkHookCallback(alarmRulesWatcher);
9595
List<AlarmMessage> alarmMessages = new ArrayList<>(2);
9696
AlarmMessage alarmMessage = new AlarmMessage();
@@ -125,7 +125,7 @@ public void testDingtalkWebhookWithSign() throws Exception {
125125
rules.getDingtalkSettingsMap().put(setting1.getFormattedName(), setting1);
126126
rules.getDingtalkSettingsMap().put(setting2.getFormattedName(), setting2);
127127

128-
AlarmRulesWatcher alarmRulesWatcher = new AlarmRulesWatcher(rules, null);
128+
AlarmRulesWatcher alarmRulesWatcher = new AlarmRulesWatcher(rules, null, null);
129129
DingtalkHookCallback dingtalkCallBack = new DingtalkHookCallback(alarmRulesWatcher);
130130
List<AlarmMessage> alarmMessages = new ArrayList<>(2);
131131
AlarmMessage alarmMessage = new AlarmMessage();

oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/feishu/FeishuHookCallbackTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void testFeishuWebhookWithoutSign() throws Exception {
8888
rules.getFeishuSettingsMap().put(setting1.getFormattedName(), setting1);
8989
rules.getFeishuSettingsMap().put(setting2.getFormattedName(), setting2);
9090

91-
AlarmRulesWatcher alarmRulesWatcher = new AlarmRulesWatcher(rules, null);
91+
AlarmRulesWatcher alarmRulesWatcher = new AlarmRulesWatcher(rules, null, null);
9292
FeishuHookCallback feishuHookCallback = new FeishuHookCallback(alarmRulesWatcher);
9393
List<AlarmMessage> alarmMessages = new ArrayList<>(2);
9494
AlarmMessage alarmMessage = new AlarmMessage();
@@ -123,7 +123,7 @@ public void testFeishuWebhookWithSign() throws Exception {
123123
rules.getFeishuSettingsMap().put(setting1.getFormattedName(), setting1);
124124
rules.getFeishuSettingsMap().put(setting2.getFormattedName(), setting2);
125125

126-
AlarmRulesWatcher alarmRulesWatcher = new AlarmRulesWatcher(rules, null);
126+
AlarmRulesWatcher alarmRulesWatcher = new AlarmRulesWatcher(rules, null, null);
127127
FeishuHookCallback feishuHookCallback = new FeishuHookCallback(alarmRulesWatcher);
128128
List<AlarmMessage> alarmMessages = new ArrayList<>(2);
129129
AlarmMessage alarmMessage = new AlarmMessage();
@@ -158,7 +158,7 @@ public void testFeishuWebhookWithSignAndAt() throws Exception {
158158
rules.getFeishuSettingsMap().put(setting1.getFormattedName(), setting1);
159159
rules.getFeishuSettingsMap().put(setting2.getFormattedName(), setting2);
160160

161-
AlarmRulesWatcher alarmRulesWatcher = new AlarmRulesWatcher(rules, null);
161+
AlarmRulesWatcher alarmRulesWatcher = new AlarmRulesWatcher(rules, null, null);
162162
FeishuHookCallback feishuHookCallback = new FeishuHookCallback(alarmRulesWatcher);
163163
List<AlarmMessage> alarmMessages = new ArrayList<>(2);
164164
AlarmMessage alarmMessage = new AlarmMessage();

0 commit comments

Comments
 (0)