未验证 提交 cc7a2c9e 编写于 作者: P pg.yang 提交者: GitHub

Fix wrong time for OTEL mock service, invalid condition(ge 0) for e2e cases (#10437)

上级 46ee9245
......@@ -20,62 +20,45 @@ cases:
expected: expected/service.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=account_max_writes --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
--name=aws_dynamodb_account_max_writes --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=account_max_reads --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
--name=aws_dynamodb_max_provisioned_read_capacity_utilization --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=max_provisioned_write_capacity_utilization --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
--name=aws_dynamodb_account_max_table_level_reads --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=max_provisioned_read_capacity_utilization --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
--name=aws_dynamodb_account_max_table_level_writes --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=account_max_table_level_reads --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
--name=aws_dynamodb_account_provisioned_read_capacity_utilization --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=account_max_table_level_writes --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
--name=aws_dynamodb_time_to_live_deleted_item_count --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=account_provisioned_read_capacity_utilization --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
--name=aws_dynamodb_user_errors --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=account_provisioned_write_capacity_utilization --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
--name=aws_dynamodb_read_system_errors --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=time_to_live_deleted_item_count --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
--name=aws_dynamodb_write_system_errors --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=user_errors --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
--name=aws_dynamodb_scan_returned_item_count --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=system_errors --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=scan_returned_item_count --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=query_returned_item_count --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=read_throttled_requests --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
--name=write_throttled_requests --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
--name=aws_dynamodb_query_returned_item_count --service-name aws-dynamodb::xxxxxxxx |yq e 'to_entries' -
expected: expected/metrics-has-value.yml
\ No newline at end of file
......@@ -15,5 +15,5 @@
{{- contains . }}
- key: {{ notEmpty .key }}
value: {{ ge .value 0 }}
value: {{ gt .value 0 }}
{{- end }}
\ No newline at end of file
......@@ -340,12 +340,14 @@
"startTimeUnixNano": "1676809260000000000",
"timeUnixNano": "1676809320000000000",
"count": "1",
"sum": "2.0",
"sum": "1.0",
"quantileValues": [
{
"value": 1.0
},
{
"quantile": 1.0
"quantile": 1.0,
"value": 1.0
}
],
"attributes": [
......@@ -381,12 +383,14 @@
"startTimeUnixNano": "1676809260000000000",
"timeUnixNano": "1676809320000000000",
"count": "1",
"sum": "2.0",
"sum": "5.0",
"quantileValues": [
{
"value": 5.0
},
{
"quantile": 1.0
"quantile": 1.0,
"value": 5.0
}
],
"attributes": [
......@@ -428,12 +432,14 @@
"startTimeUnixNano": "1676809260000000000",
"timeUnixNano": "1676809320000000000",
"count": "1",
"sum": "2.0",
"sum": "5.0",
"quantileValues": [
{
"value": 5.0
},
{
"quantile": 1.0
"quantile": 1.0,
"value": 5.0
}
],
"attributes": [
......@@ -466,6 +472,104 @@
]
}
},
{
"name": "amazonaws.com/AWS/DynamoDB/ThrottledRequests",
"unit": "{Count}",
"summary": {
"dataPoints": [
{
"startTimeUnixNano": "1676809260000000000",
"timeUnixNano": "1676809320000000000",
"count": "1",
"sum": "2.0",
"quantileValues": [
{
"value": 2.0
},
{
"quantile": 1.0,
"value": 2.0
}
],
"attributes": [
{
"key": "Namespace",
"value": {
"stringValue": "AWS/DynamoDB"
}
},
{
"key": "MetricName",
"value": {
"stringValue": "ThrottledRequests"
}
},
{
"key": "Operation",
"value": {
"stringValue": "Query"
}
},
{
"key": "TableName",
"value": {
"stringValue": "test"
}
}
]
}
]
}
},
{
"name": "amazonaws.com/AWS/DynamoDB/ThrottledRequests",
"unit": "{Count}",
"summary": {
"dataPoints": [
{
"startTimeUnixNano": "1676809260000000000",
"timeUnixNano": "1676809320000000000",
"count": "1",
"sum": "2.0",
"quantileValues": [
{
"value": 2.0
},
{
"quantile": 1.0,
"value": 2.0
}
],
"attributes": [
{
"key": "Namespace",
"value": {
"stringValue": "AWS/DynamoDB"
}
},
{
"key": "MetricName",
"value": {
"stringValue": "ThrottledRequests"
}
},
{
"key": "Operation",
"value": {
"stringValue": "PutItem"
}
},
{
"key": "TableName",
"value": {
"stringValue": "test"
}
}
]
}
]
}
},
{
"name": "amazonaws.com/AWS/DynamoDB/UserErrors",
"unit": "{Count}",
......@@ -478,9 +582,11 @@
"sum": "2.0",
"quantileValues": [
{
"value": 2.0
},
{
"quantile": 1.0
"quantile": 1.0,
"value": 2.0
}
],
"attributes": [
......@@ -519,9 +625,11 @@
"sum": "2.0",
"quantileValues": [
{
"value": 2.0
},
{
"quantile": 1.0
"quantile": 1.0,
"value": 2.0
}
],
"attributes": [
......@@ -542,6 +650,61 @@
"value": {
"stringValue": "test"
}
},
{
"key": "Operation",
"value": {
"stringValue": "GetItem"
}
}
]
}
]
}
},
{
"name": "amazonaws.com/AWS/DynamoDB/SystemErrors",
"unit": "{Count}",
"summary": {
"dataPoints": [
{
"startTimeUnixNano": "1676809260000000000",
"timeUnixNano": "1676809320000000000",
"count": "1",
"sum": "2.0",
"quantileValues": [
{
"value": 2.0
},
{
"quantile": 1.0,
"value": 2.0
}
],
"attributes": [
{
"key": "Namespace",
"value": {
"stringValue": "AWS/DynamoDB"
}
},
{
"key": "MetricName",
"value": {
"stringValue": "SystemErrors"
}
},
{
"key": "TableName",
"value": {
"stringValue": "test"
}
},
{
"key": "Operation",
"value": {
"stringValue": "PutItem"
}
}
]
}
......
......@@ -22,7 +22,7 @@
expected: expected/instance.yml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql endpoint ls --service-name=aws-eks-cluster::SkyWalking
expected: expected/endpoint.yml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name=eks_cluster_node_memory_utilization --service-name=aws-eks-cluster::SkyWalking --instance-name=ip-172-31-23-33.ap-northeast-1.compute.internal | yq e 'to_entries' -
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name=eks_cluster_node_memory_utilization --service-name=aws-eks-cluster::SkyWalking --instance-name=ip-172-31-10-158.ap-northeast-1.compute.internal | yq e 'to_entries' -
expected: expected/metrics-has-value.yml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name=eks_cluster_service_pod_net_rx_bytes --service-name=aws-eks-cluster::SkyWalking --endpoint-name=kube-dns | yq e 'to_entries' -
expected: expected/metrics-has-value.yml
......@@ -15,5 +15,5 @@
{{- contains . }}
- key: {{ notEmpty .key }}
value: {{ ge .value 0 }}
value: {{ gt .value 0 }}
{{- end }}
......@@ -264,7 +264,7 @@
"dataPoints": [
{
"timeUnixNano": "1669442684150753695",
"asDouble": 0
"asDouble": 80
}
]
}
......
......@@ -15,5 +15,5 @@
{{- contains . }}
- key: {{ notEmpty .key }}
value: {{ ge .value 0 }}
value: {{ gt .value 0 }}
{{- end }}
......@@ -41,6 +41,7 @@
"startTimeUnixNano": "1674547500000000000",
"timeUnixNano": "1674547560000000000",
"count": "1",
"sum": "5",
"quantileValues": [
{
},
......@@ -87,6 +88,7 @@
"startTimeUnixNano": "1674547500000000000",
"timeUnixNano": "1674547560000000000",
"count": "1",
"sum": "5",
"quantileValues": [
{
},
......
......@@ -18,30 +18,30 @@
value:
{{- contains .value }}
- key: {{ notEmpty .key }}
value: {{ ge .value 0 }}
value: {{ gt .value 0 }}
{{- end }}
- key: 1
value:
{{- contains .value }}
- key: {{ notEmpty .key }}
value: {{ ge .value 0 }}
value: {{ gt .value 0 }}
{{- end }}
- key: 2
value:
{{- contains .value }}
- key: {{ notEmpty .key }}
value: {{ ge .value 0 }}
value: {{ gt .value 0 }}
{{- end }}
- key: 3
value:
{{- contains .value }}
- key: {{ notEmpty .key }}
value: {{ ge .value 0 }}
value: {{ gt .value 0 }}
{{- end }}
- key: 4
value:
{{- contains .value }}
- key: {{ notEmpty .key }}
value: {{ ge .value 0 }}
value: {{ gt .value 0 }}
{{- end }}
{{- end }}
# 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.
{{- contains . }}
- key: {{ notEmpty .key }}
value: {{ ge .value 0 }}
{{- end }}
......@@ -35,7 +35,7 @@
# virtual cache
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name=cache_read_resp_time --service-id=R3VhdmFDYWNoZS1sb2NhbA==.0 | yq e 'to_entries' -
expected: expected/metrics-has-value0.yml
expected: expected/metrics-has-value.yml
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name=cache_write_sla --service-id=R3VhdmFDYWNoZS1sb2NhbA==.0 | yq e 'to_entries' -
expected: expected/metrics-has-value.yml
......@@ -48,4 +48,4 @@
# virtual database
- query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name=database_access_resp_time --service-id=bG9jYWxob3N0Oi0x.0 | yq e 'to_entries' -
expected: expected/metrics-has-value0.yml
\ No newline at end of file
expected: expected/metrics-has-value.yml
\ No newline at end of file
......@@ -22,7 +22,7 @@
expected: expected/service-endpoint.yml
# endpoint metrics
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name=mq_service_consume_latency --service-id=a2Fma2E6OTA5Mg==.0 |yq e 'to_entries' -
expected: expected/metrics-has-value0.yml
expected: expected/metrics-has-value.yml
# endpoint metrics
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name=mq_endpoint_consume_cpm --endpoint-name='topic' --service-id=a2Fma2E6OTA5Mg==.0 |yq e 'to_entries' -
expected: expected/metrics-has-value0.yml
\ No newline at end of file
expected: expected/metrics-has-value.yml
\ No newline at end of file
......@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
{{- contains . }}
{{- contains . }}
- key: {{ notEmpty .key }}
value: {{ ge .value 0 }}
{{- end }}
value: {{ ge .value 1 }}
{{- end }}
......@@ -15,8 +15,8 @@
# This file is used to show how to write configuration files and can be used to test.
cases:
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
expected: expected/service.yml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name=meter_win_cpu_total_percentage --service-name=10.211.55.3 | yq e 'to_entries' -
expected: expected/metrics-has-value.yml
cases:
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
expected: expected/service.yml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name=meter_win_memory_swap_total --service-name=10.211.55.3 | yq e 'to_entries' -
expected: expected/metrics-has-value.yml
......@@ -89,7 +89,7 @@ public class OtelMetricsSender {
}
private String rewriteTimeField(File file) throws IOException {
final long nanoTime = System.nanoTime();
final long nanoTime = System.currentTimeMillis() * 1000000L;
final Configuration configuration = Configuration.builder()
.options(Option.SUPPRESS_EXCEPTIONS)
.evaluationListener(found -> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册