Add SkyPredictor project to E2E Testing alarm with baseline (#13047)

This commit is contained in:
mrproliu 2025-02-20 16:42:03 +08:00 committed by GitHub
parent 4049f25dd5
commit c09d9394a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 689 additions and 212 deletions

View File

@ -404,6 +404,13 @@ jobs:
- name: Alarm BanyanDB
config: test/e2e-v2/cases/alarm/banyandb/e2e.yaml
- name: Baseline-driven Alarm ES
config: test/e2e-v2/cases/baseline/es/e2e.yaml
- name: Baseline-driven Alarm ES Sharding
config: test/e2e-v2/cases/baseline/es/es-sharding/e2e.yaml
- name: Baseline-driven Alarm BanyanDB
config: test/e2e-v2/cases/baseline/banyandb/e2e.yaml
- name: TTL ES 7.16.3
config: test/e2e-v2/cases/ttl/es/e2e.yaml
env: ES_VERSION=7.16.3

View File

@ -17,7 +17,7 @@
*/
syntax = "proto3";
package skywalking.baseline.v3;
package skywalking.v3;
import "google/protobuf/empty.proto";

View File

@ -43,15 +43,6 @@ rules:
tags:
level: CRITICAL
receivers: zhangsan
baseline_rule:
expression: sum(service_resp_time > baseline(service_resp_time,upper)) >= 1
period: 10
message: Response time of service {name} is more than baseline in 1 minutes of last 10 minutes.
tags:
level: CRITICAL
receivers: zhangsan
hooks:
- webhook.none
hooks:
webhook:

View File

@ -30,14 +30,11 @@ services:
environment:
SW_STORAGE: banyandb
SW_SEARCHABLE_ALARM_TAG_KEYS: level,receivers
SW_API_PIPELINE_BASELINE_SERVICE_HOST: baseline-server
ports:
- 12800
depends_on:
banyandb:
condition: service_healthy
baseline-server:
condition: service_healthy
volumes:
- ../alarm-settings.yml:/skywalking/config/alarm-settings.yml
@ -51,20 +48,5 @@ services:
oap:
condition: service_healthy
baseline-server:
image: "eclipse-temurin:11-jre"
volumes:
- ../../../java-test-service/e2e-mock-baseline-server/target/e2e-mock-baseline-server-2.0.0.jar:/e2e-mock-baseline-server-2.0.0.jar
command: [ "java", "-jar", "/e2e-mock-baseline-server-2.0.0.jar" ]
networks:
- e2e
ports:
- 18080
healthcheck:
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/18080"]
interval: 5s
timeout: 60s
retries: 120
networks:
e2e:

View File

@ -37,14 +37,11 @@ services:
environment:
SW_STORAGE: elasticsearch
SW_SEARCHABLE_ALARM_TAG_KEYS: level,receivers
SW_API_PIPELINE_BASELINE_SERVICE_HOST: baseline-server
ports:
- 12800
depends_on:
es:
condition: service_healthy
baseline-server:
condition: service_healthy
volumes:
- ../alarm-settings.yml:/skywalking/config/alarm-settings.yml
@ -58,20 +55,5 @@ services:
oap:
condition: service_healthy
baseline-server:
image: "eclipse-temurin:11-jre"
volumes:
- ../../../java-test-service/e2e-mock-baseline-server/target/e2e-mock-baseline-server-2.0.0.jar:/e2e-mock-baseline-server-2.0.0.jar
command: [ "java", "-jar", "/e2e-mock-baseline-server-2.0.0.jar" ]
networks:
- e2e
ports:
- 18080
healthcheck:
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/18080"]
interval: 5s
timeout: 60s
retries: 120
networks:
e2e:

View File

@ -38,14 +38,11 @@ services:
SW_STORAGE: elasticsearch
SW_SEARCHABLE_ALARM_TAG_KEYS: level,receivers
SW_STORAGE_ES_LOGIC_SHARDING: "true"
SW_API_PIPELINE_BASELINE_SERVICE_HOST: baseline-server
ports:
- 12800
depends_on:
es:
condition: service_healthy
baseline-server:
condition: service_healthy
volumes:
- ../../alarm-settings.yml:/skywalking/config/alarm-settings.yml
@ -59,20 +56,5 @@ services:
oap:
condition: service_healthy
baseline-server:
image: "eclipse-temurin:11-jre"
volumes:
- ../../../../java-test-service/e2e-mock-baseline-server/target/e2e-mock-baseline-server-2.0.0.jar:/e2e-mock-baseline-server-2.0.0.jar
command: [ "java", "-jar", "/e2e-mock-baseline-server-2.0.0.jar" ]
networks:
- e2e
ports:
- 18080
healthcheck:
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/18080"]
interval: 5s
timeout: 60s
retries: 120
networks:
e2e:

View File

@ -0,0 +1,30 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
debuggingtrace: null
type: TIME_SERIES_VALUES
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
value: {{ notEmpty .value }}
owner: null
traceid: null
{{- end}}
{{- end}}
error: null

View File

@ -58,60 +58,4 @@ msgs:
{{- end }}
{{- end }}
{{- end }}
- starttime: {{ gt .starttime 0 }}
scope: Service
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
name: e2e-service-provider
message: Response time of service e2e-service-provider is more than baseline in 1 minutes of last 10 minutes.
tags:
- key: level
value: CRITICAL
- key: receivers
value: zhangsan
events:
{{- contains .events }}
- uuid: {{ notEmpty .uuid }}
source:
service: e2e-service-provider
serviceinstance: ""
endpoint: ""
name: Alarm
type: ""
message: {{ notEmpty .message }}
parameters: []
starttime: {{ gt .starttime 0 }}
endtime: {{ gt .endtime 0 }}
layer: GENERAL
{{- end }}
snapshot:
expression: sum(service_resp_time > baseline(service_resp_time,upper)) >= 1
metrics:
{{- contains .snapshot.metrics }}
- name: service_resp_time
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
owner: null
value: {{ .value }}
traceid: null
{{- end }}
{{- end }}
- name: baseline(service_resp_time,upper)
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
owner: null
value: 10
traceid: null
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -58,60 +58,4 @@ msgs:
{{- end }}
{{- end }}
{{- end }}
- starttime: {{ gt .starttime 0 }}
scope: Service
id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
name: e2e-service-provider
message: Response time of service e2e-service-provider is more than baseline in 1 minutes of last 10 minutes.
tags:
- key: level
value: CRITICAL
- key: receivers
value: zhangsan
events:
{{- contains .events }}
- uuid: {{ notEmpty .uuid }}
source:
service: e2e-service-provider
serviceinstance: ""
endpoint: ""
name: Alarm
type: ""
message: {{ notEmpty .message }}
parameters: []
starttime: {{ gt .starttime 0 }}
endtime: {{ gt .endtime 0 }}
layer: GENERAL
{{- end }}
snapshot:
expression: sum(service_resp_time > baseline(service_resp_time,upper)) >= 1
metrics:
{{- contains .snapshot.metrics }}
- name: service_resp_time
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
owner: null
value: {{ .value }}
traceid: null
{{- end }}
{{- end }}
- name: baseline(service_resp_time,upper)
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
owner: null
value: 10
traceid: null
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -39,15 +39,12 @@ services:
environment:
SW_STORAGE: mysql
SW_SEARCHABLE_ALARM_TAG_KEYS: level,receivers
SW_API_PIPELINE_BASELINE_SERVICE_HOST: baseline-server
entrypoint: ['sh', '-c', '/download-mysql.sh /skywalking/oap-libs && /skywalking/docker-entrypoint.sh']
ports:
- 12800
depends_on:
mysql:
condition: service_healthy
baseline-server:
condition: service_healthy
volumes:
- ../alarm-settings.yml:/skywalking/config/alarm-settings.yml
@ -61,19 +58,5 @@ services:
oap:
condition: service_healthy
baseline-server:
image: "eclipse-temurin:11-jre"
volumes:
- ../../../java-test-service/e2e-mock-baseline-server/target/e2e-mock-baseline-server-2.0.0.jar:/e2e-mock-baseline-server-2.0.0.jar
command: [ "java", "-jar", "/e2e-mock-baseline-server-2.0.0.jar" ]
networks:
- e2e
ports:
- 18080
healthcheck:
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/18080"]
interval: 5s
timeout: 60s
retries: 120
networks:
e2e:

View File

@ -39,14 +39,11 @@ services:
SW_STORAGE: postgresql
SW_JDBC_URL: "jdbc:postgresql://postgres:5432/skywalking"
SW_SEARCHABLE_ALARM_TAG_KEYS: level,receivers
SW_API_PIPELINE_BASELINE_SERVICE_HOST: baseline-server
ports:
- 12800
depends_on:
postgres:
condition: service_healthy
baseline-server:
condition: service_healthy
volumes:
- ../alarm-settings.yml:/skywalking/config/alarm-settings.yml
@ -60,20 +57,5 @@ services:
oap:
condition: service_healthy
baseline-server:
image: "eclipse-temurin:11-jre"
volumes:
- ../../../java-test-service/e2e-mock-baseline-server/target/e2e-mock-baseline-server-2.0.0.jar:/e2e-mock-baseline-server-2.0.0.jar
command: [ "java", "-jar", "/e2e-mock-baseline-server-2.0.0.jar" ]
networks:
- e2e
ports:
- 18080
healthcheck:
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/18080"]
interval: 5s
timeout: 60s
retries: 120
networks:
e2e:

View File

@ -0,0 +1,28 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cases:
- query: |
curl -s -XPOST http://${sender_host}:${sender_9093}/sendMetrics4Predict/7 > /dev/null;
sleep 10;
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=service_resp_time --service-name=e2e-test-dest-service
expected: expected/metrics-has-value.yml
# before silence alarm list level=CRITICAL,receivers=zhangsan
- query: |
sleep 10;
curl -s -XPOST http://${sender_host}:${sender_9093}/sendMetrics4Predict/1 > /dev/null; # still trigger the service mesh traffic for keep it have traffic
sleep 10;
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql alarm ls --tags level=CRITICAL,receivers=zhangsan
expected: expected/critical.yml

View File

@ -0,0 +1,23 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
rules:
baseline_rule:
expression: sum(service_resp_time > baseline(service_resp_time,lower)) >= 1
period: 10
message: Response time of service {name} is more than baseline in 1 minutes of last 10 minutes.
tags:
level: CRITICAL
receivers: zhangsan

View File

@ -0,0 +1,96 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
version: '2.1'
services:
banyandb:
extends:
file: ../../../script/docker-compose/base-compose.yml
service: banyandb
networks:
- e2e
oap:
extends:
file: ../../../script/docker-compose/base-compose.yml
service: oap
environment:
SW_STORAGE: banyandb
SW_SEARCHABLE_ALARM_TAG_KEYS: level,receivers
SW_API_PIPELINE_BASELINE_SERVICE_HOST: baseline-predictor
ports:
- 12800
depends_on:
banyandb:
condition: service_healthy
volumes:
- ../alarm-settings.yml:/skywalking/config/alarm-settings.yml
provider:
extends:
file: ../../../script/docker-compose/base-compose.yml
service: provider
ports:
- 9090
depends_on:
oap:
condition: service_healthy
baseline-predictor:
extends:
file: ../../../script/docker-compose/base-compose.yml
service: baseline-predictor
networks:
- e2e
ports:
- 18080
environment:
BASELINE_FETCH_METRICS: service_resp_time,service_percentile
BASELINE_FETCH_CRON: "* * * * *"
BASELINE_FETCH_SERVER_ENDPOINT: http://oap:12800
BASELINE_FETCH_SERVER_LAYERS: MESH
healthcheck:
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/18080"]
interval: 5s
timeout: 60s
retries: 120
depends_on:
oap:
condition: service_healthy
sender:
image: "eclipse-temurin:8-jre"
volumes:
- ./../../../java-test-service/e2e-mock-sender/target/e2e-mock-sender-2.0.0.jar:/e2e-mock-sender-2.0.0.jar
command: [ "java", "-jar", "/e2e-mock-sender-2.0.0.jar" ]
environment:
OAP_HOST: oap
OAP_GRPC_PORT: 11800
networks:
- e2e
ports:
- 9093
healthcheck:
test: [ "CMD", "sh", "-c", "nc -nz 127.0.0.1 9093" ]
interval: 5s
timeout: 60s
retries: 120
depends_on:
oap:
condition: service_healthy
networks:
e2e:

View File

@ -0,0 +1,47 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file is used to show how to write configuration files and can be used to test.
setup:
env: compose
file: docker-compose.yml
timeout: 20m
init-system-environment: ../../../script/env
steps:
- name: set PATH
command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH
- name: install yq
command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh yq
- name: install swctl
command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh swctl
trigger:
action: http
interval: 3s
times: 30
url: http://${provider_host}:${provider_9090}/users
method: POST
body: '{"id":"123","name":"skywalking"}'
headers:
"Content-Type": "application/json"
verify:
retry:
count: 20
interval: 3s
cases:
- includes:
- ../alarm-cases.yaml

View File

@ -0,0 +1,102 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
version: '2.1'
services:
es:
image: elastic/elasticsearch:7.15.0
expose:
- 9200
networks:
- e2e
environment:
- discovery.type=single-node
healthcheck:
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9200"]
interval: 5s
timeout: 60s
retries: 120
oap:
extends:
file: ../../../script/docker-compose/base-compose.yml
service: oap
environment:
SW_STORAGE: elasticsearch
SW_SEARCHABLE_ALARM_TAG_KEYS: level,receivers
SW_API_PIPELINE_BASELINE_SERVICE_HOST: baseline-predictor
ports:
- 12800
depends_on:
es:
condition: service_healthy
volumes:
- ../alarm-settings.yml:/skywalking/config/alarm-settings.yml
provider:
extends:
file: ../../../script/docker-compose/base-compose.yml
service: provider
ports:
- 9090
depends_on:
oap:
condition: service_healthy
baseline-predictor:
extends:
file: ../../../script/docker-compose/base-compose.yml
service: baseline-predictor
networks:
- e2e
ports:
- 18080
environment:
BASELINE_FETCH_METRICS: service_resp_time,service_percentile
BASELINE_FETCH_CRON: "* * * * *"
BASELINE_FETCH_SERVER_ENDPOINT: http://oap:12800
BASELINE_FETCH_SERVER_LAYERS: MESH
healthcheck:
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/18080" ]
interval: 5s
timeout: 60s
retries: 120
depends_on:
oap:
condition: service_healthy
sender:
image: "eclipse-temurin:8-jre"
volumes:
- ./../../../java-test-service/e2e-mock-sender/target/e2e-mock-sender-2.0.0.jar:/e2e-mock-sender-2.0.0.jar
command: [ "java", "-jar", "/e2e-mock-sender-2.0.0.jar" ]
environment:
OAP_HOST: oap
OAP_GRPC_PORT: 11800
networks:
- e2e
ports:
- 9093
healthcheck:
test: [ "CMD", "sh", "-c", "nc -nz 127.0.0.1 9093" ]
interval: 5s
timeout: 60s
retries: 120
depends_on:
oap:
condition: service_healthy
networks:
e2e:

View File

@ -0,0 +1,47 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file is used to show how to write configuration files and can be used to test.
setup:
env: compose
file: docker-compose.yml
timeout: 20m
init-system-environment: ../../../script/env
steps:
- name: set PATH
command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH
- name: install yq
command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh yq
- name: install swctl
command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh swctl
trigger:
action: http
interval: 3s
times: 30
url: http://${provider_host}:${provider_9090}/users
method: POST
body: '{"id":"123","name":"skywalking"}'
headers:
"Content-Type": "application/json"
verify:
retry:
count: 20
interval: 3s
cases:
- includes:
- ../alarm-cases.yaml

View File

@ -0,0 +1,104 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
version: '2.1'
services:
es:
image: elastic/elasticsearch:7.15.0
expose:
- 9200
networks:
- e2e
environment:
- discovery.type=single-node
healthcheck:
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9200"]
interval: 5s
timeout: 60s
retries: 120
oap:
extends:
file: ../../../../script/docker-compose/base-compose.yml
service: oap
environment:
SW_STORAGE: elasticsearch
SW_SEARCHABLE_ALARM_TAG_KEYS: level,receivers
SW_STORAGE_ES_LOGIC_SHARDING: "true"
SW_API_PIPELINE_BASELINE_SERVICE_HOST: baseline-predictor
ports:
- 12800
depends_on:
es:
condition: service_healthy
volumes:
- ../../alarm-settings.yml:/skywalking/config/alarm-settings.yml
provider:
extends:
file: ../../../../script/docker-compose/base-compose.yml
service: provider
ports:
- 9090
depends_on:
oap:
condition: service_healthy
baseline-predictor:
extends:
file: ../../../../script/docker-compose/base-compose.yml
service: baseline-predictor
networks:
- e2e
ports:
- 18080
environment:
BASELINE_FETCH_METRICS: service_resp_time,service_percentile
BASELINE_FETCH_CRON: "* * * * *"
BASELINE_FETCH_SERVER_ENDPOINT: http://oap:12800
BASELINE_FETCH_SERVER_LAYERS: MESH
healthcheck:
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/18080" ]
interval: 5s
timeout: 60s
retries: 120
depends_on:
oap:
condition: service_healthy
sender:
image: "eclipse-temurin:8-jre"
volumes:
- ./../../../../java-test-service/e2e-mock-sender/target/e2e-mock-sender-2.0.0.jar:/e2e-mock-sender-2.0.0.jar
command: [ "java", "-jar", "/e2e-mock-sender-2.0.0.jar" ]
environment:
OAP_HOST: oap
OAP_GRPC_PORT: 11800
networks:
- e2e
ports:
- 9093
healthcheck:
test: [ "CMD", "sh", "-c", "nc -nz 127.0.0.1 9093" ]
interval: 5s
timeout: 60s
retries: 120
depends_on:
oap:
condition: service_healthy
networks:
e2e:

View File

@ -0,0 +1,47 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file is used to show how to write configuration files and can be used to test.
setup:
env: compose
file: docker-compose.yml
timeout: 20m
init-system-environment: ../../../../script/env
steps:
- name: set PATH
command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH
- name: install yq
command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh yq
- name: install swctl
command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh swctl
trigger:
action: http
interval: 3s
times: 30
url: http://${provider_host}:${provider_9090}/users
method: POST
body: '{"id":"123","name":"skywalking"}'
headers:
"Content-Type": "application/json"
verify:
retry:
count: 20
interval: 3s
cases:
- includes:
- ../../alarm-cases.yaml

View File

@ -0,0 +1,74 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
msgs:
{{- contains .msgs }}
- starttime: {{ gt .starttime 0 }}
scope: Service
id: ZTJlLXRlc3QtZGVzdC1zZXJ2aWNl.1
name: e2e-test-dest-service
message: Response time of service e2e-test-dest-service is more than baseline in 1 minutes of last 10 minutes.
tags:
- key: level
value: CRITICAL
- key: receivers
value: zhangsan
events:
{{- contains .events }}
- uuid: {{ notEmpty .uuid }}
source:
service: e2e-test-dest-service
serviceinstance: ""
endpoint: ""
name: Alarm
type: ""
message: {{ notEmpty .message }}
parameters: []
starttime: {{ gt .starttime 0 }}
endtime: {{ gt .endtime 0 }}
layer: MESH
{{- end }}
snapshot:
expression: sum(service_resp_time > baseline(service_resp_time,lower)) >= 1
metrics:
{{- contains .snapshot.metrics }}
- name: service_resp_time
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
owner: null
value: {{ .value }}
traceid: null
{{- end }}
{{- end }}
- name: baseline(service_resp_time,lower)
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
owner: null
value: "1999"
traceid: null
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,30 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
debuggingtrace: null
type: TIME_SERIES_VALUES
results:
{{- contains .results }}
- metric:
labels: []
values:
{{- contains .values }}
- id: {{ notEmpty .id }}
value: {{ notEmpty .value }}
owner: null
traceid: null
{{- end}}
{{- end}}
error: null

View File

@ -17,7 +17,7 @@
*/
syntax = "proto3";
package skywalking.baseline.v3;
package skywalking.v3;
import "google/protobuf/empty.proto";

View File

@ -88,6 +88,43 @@ public class ServiceMeshMetricSenderController {
return "Metrics send success!";
}
@PostMapping("/sendMetrics4Predict/{days}")
public String sendMetrics4Predict(@PathVariable("days") int days) throws Exception {
final HTTPServiceMeshMetric.Builder builder =
HTTPServiceMeshMetric
.newBuilder()
.setSourceServiceName("e2e-test-source-service")
.setSourceServiceInstance("e2e-test-source-service-instance")
.setDestServiceName("e2e-test-dest-service")
.setDestServiceInstance("e2e-test-dest-service-instance")
.setEndpoint("e2e/test")
.setLatency(2000)
.setResponseCode(200)
.setStatus(SUCCESS)
.setProtocol(Protocol.HTTP)
.setDetectPoint(DetectPoint.server);
final LocalDateTime now = LocalDateTime.now(ZoneOffset.UTC);
LocalDateTime startTime = now.minusDays(days + 1);
while (!startTime.isAfter(now)) {
startTime = startTime.plusMinutes(1);
final LocalDateTime endTime = startTime.plusMinutes(1);
sendMetrics(ServiceMeshMetrics
.newBuilder()
.setHttpMetrics(
HTTPServiceMeshMetrics
.newBuilder()
.addMetrics(
builder
.setStartTime(startTime.toEpochSecond(ZoneOffset.UTC) * 1000)
.setEndTime(endTime.toEpochSecond(ZoneOffset.UTC) * 1000)))
.build());
}
return "Metrics send success!";
}
void sendMetrics(final ServiceMeshMetrics metrics) throws InterruptedException {
final CountDownLatch latch = new CountDownLatch(1);

View File

@ -114,5 +114,19 @@ services:
timeout: 60s
retries: 120
baseline-predictor:
image: "ghcr.io/skyapm/skypredictor:${SW_PREDICTOR_COMMIT}"
networks:
- e2e
expose:
- 18080
environment:
BASELINE_FETCH_SERVER_ENDPOINT: http://oap:12800
healthcheck:
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/18080" ]
interval: 5s
timeout: 60s
retries: 120
networks:
e2e:

View File

@ -25,5 +25,6 @@ SW_KUBERNETES_COMMIT_SHA=6fe5e6f0d3b7686c6be0457733e825ee68cb9b35
SW_ROVER_COMMIT=40d03c14d638339bf4aa6ec7376d421323de865a
SW_BANYANDB_COMMIT=f484391b33674fd5b6c6c1903056803818f5393a
SW_AGENT_PHP_COMMIT=3192c553002707d344bd6774cfab5bc61f67a1d3
SW_PREDICTOR_COMMIT=9d6da24001a63f435d8a702b122499788f2b318b
SW_CTL_COMMIT=67cbc89dd7b214d5791321a7ca992f940cb586ba