Skip to content

Commit 63843a2

Browse files
committed
SWIP-12 fix: split multi-doc log-mal-rule into per-platform files
CI caught: MALFilterExecutionTest failed with 'expected a single document in the stream' on log-mal-rules/miniprogram.yaml at the '---' separator. Rules.loadRules() uses Yaml.loadAs(r, Rule.class) — single-document only. Multi-doc YAML would also fail at OAP startup, not just in tests. Split into two single-doc files: - log-mal-rules/miniprogram-wechat.yaml - log-mal-rules/miniprogram-alipay.yaml Update application.yml malFiles default, storage e2e config-dump expected, and both miniprogram e2e docker-compose SW_LOG_MAL_FILES env values. MALFilterExecutionTest + MALExpressionExecutionTest + LALScriptExecutionTest all green locally (1302 MAL, 134 LAL).
1 parent 8ad2b51 commit 63843a2

6 files changed

Lines changed: 32 additions & 15 deletions

File tree

oap-server/server-starter/src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ log-analyzer:
238238
selector: ${SW_LOG_ANALYZER:default}
239239
default:
240240
lalFiles: ${SW_LOG_LAL_FILES:envoy-als,mesh-dp,mysql-slowsql,pgsql-slowsql,redis-slowsql,k8s-service,nginx,envoy-ai-gateway,miniprogram,default}
241-
malFiles: ${SW_LOG_MAL_FILES:"nginx,miniprogram"}
241+
malFiles: ${SW_LOG_MAL_FILES:"nginx,miniprogram-wechat,miniprogram-alipay"}
242242

243243
event-analyzer:
244244
selector: ${SW_EVENT_ANALYZER:default}

oap-server/server-starter/src/main/resources/log-mal-rules/miniprogram.yaml renamed to oap-server/server-starter/src/main/resources/log-mal-rules/miniprogram-alipay.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,11 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
# Log-MAL rules for WeChat / Alipay Mini Program error counters.
16+
# Log-MAL rule for Alipay Mini Program error counts.
1717
# Consumes `miniprogram_error_count` samples emitted by the LAL rule
18-
# (lal/miniprogram.yaml, metrics{} block), one per error log, and
19-
# aggregates per-platform into `meter_wechat_mp_error_count` /
20-
# `meter_alipay_mp_error_count`. The top-level filter gates each doc
21-
# to the correct platform so the two rules do not double-count.
18+
# (lal/miniprogram.yaml metrics{} block), filtered to miniprogram_platform
19+
# == 'alipay', aggregated under meter_alipay_mp_error_count.
2220

23-
metricPrefix: meter_wechat_mp
24-
filter: "{ tags -> tags.miniprogram_platform == 'wechat' }"
25-
metricsRules:
26-
- name: error_count
27-
exp: miniprogram_error_count.sum(['service_name', 'exception_type']).downsampling(SUM).service(['service_name'], Layer.WECHAT_MINI_PROGRAM)
28-
---
2921
metricPrefix: meter_alipay_mp
3022
filter: "{ tags -> tags.miniprogram_platform == 'alipay' }"
3123
metricsRules:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Log-MAL rule for WeChat Mini Program error counts.
17+
# Consumes `miniprogram_error_count` samples emitted by the LAL rule
18+
# (lal/miniprogram.yaml metrics{} block), filtered to miniprogram_platform
19+
# == 'wechat', aggregated under meter_wechat_mp_error_count.
20+
21+
metricPrefix: meter_wechat_mp
22+
filter: "{ tags -> tags.miniprogram_platform == 'wechat' }"
23+
metricsRules:
24+
- name: error_count
25+
exp: miniprogram_error_count.sum(['service_name', 'exception_type']).downsampling(SUM).service(['service_name'], Layer.WECHAT_MINI_PROGRAM)

test/e2e-v2/cases/miniprogram/alipay/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ services:
2525
SW_OTEL_RECEIVER_ENABLED_HANDLERS: "otlp-traces,otlp-metrics,otlp-logs"
2626
SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES: "miniprogram/alipay-mini-program,miniprogram/alipay-mini-program-instance"
2727
SW_LOG_LAL_FILES: "miniprogram,default"
28-
SW_LOG_MAL_FILES: "miniprogram"
28+
SW_LOG_MAL_FILES: "miniprogram-alipay"
2929
SW_LOG_ANALYZER: default
3030

3131
banyandb:

test/e2e-v2/cases/miniprogram/wechat/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ services:
2525
SW_OTEL_RECEIVER_ENABLED_HANDLERS: "otlp-traces,otlp-metrics,otlp-logs"
2626
SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES: "miniprogram/wechat-mini-program,miniprogram/wechat-mini-program-instance"
2727
SW_LOG_LAL_FILES: "miniprogram,default"
28-
SW_LOG_MAL_FILES: "miniprogram"
28+
SW_LOG_MAL_FILES: "miniprogram-wechat"
2929
SW_LOG_ANALYZER: default
3030

3131
banyandb:

test/e2e-v2/cases/storage/expected/config-dump.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ storage.mysql.properties.dataSource.useServerPrepStmts=true
143143
core.default.gRPCThreadPoolSize=-1
144144
status-query.default.keywords4MaskingSecretsOfConfig=user,password,token,accessKey,secretKey,authentication
145145
storage.mysql.maxSizeOfBatchSql=2000
146-
log-analyzer.default.malFiles=nginx,miniprogram
146+
log-analyzer.default.malFiles=nginx,miniprogram-wechat,miniprogram-alipay
147147
telemetry.prometheus.port=1234
148148
core.default.recordDataTTL=3
149149
core.default.maxHttpUrisNumberPerService=3000

0 commit comments

Comments
 (0)