未验证 提交 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: ...@@ -20,62 +20,45 @@ cases:
expected: expected/service.yml expected: expected/service.yml
- query: | - query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \ 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 expected: expected/metrics-has-value.yml
- query: | - query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \ 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 expected: expected/metrics-has-value.yml
- query: | - query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \ 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 expected: expected/metrics-has-value.yml
- query: | - query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \ 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 expected: expected/metrics-has-value.yml
- query: | - query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \ 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 expected: expected/metrics-has-value.yml
- query: | - query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \ 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 expected: expected/metrics-has-value.yml
- query: | - query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \ 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 expected: expected/metrics-has-value.yml
- query: | - query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \ 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 expected: expected/metrics-has-value.yml
- query: | - query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \ 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 expected: expected/metrics-has-value.yml
- query: | - query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \ 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 expected: expected/metrics-has-value.yml
- query: | - query: |
swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \ 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' - --name=aws_dynamodb_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=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' -
expected: expected/metrics-has-value.yml expected: expected/metrics-has-value.yml
\ No newline at end of file
...@@ -15,5 +15,5 @@ ...@@ -15,5 +15,5 @@
{{- contains . }} {{- contains . }}
- key: {{ notEmpty .key }} - key: {{ notEmpty .key }}
value: {{ ge .value 0 }} value: {{ gt .value 0 }}
{{- end }} {{- end }}
\ No newline at end of file
...@@ -340,12 +340,14 @@ ...@@ -340,12 +340,14 @@
"startTimeUnixNano": "1676809260000000000", "startTimeUnixNano": "1676809260000000000",
"timeUnixNano": "1676809320000000000", "timeUnixNano": "1676809320000000000",
"count": "1", "count": "1",
"sum": "2.0", "sum": "1.0",
"quantileValues": [ "quantileValues": [
{ {
"value": 1.0
}, },
{ {
"quantile": 1.0 "quantile": 1.0,
"value": 1.0
} }
], ],
"attributes": [ "attributes": [
...@@ -381,12 +383,14 @@ ...@@ -381,12 +383,14 @@
"startTimeUnixNano": "1676809260000000000", "startTimeUnixNano": "1676809260000000000",
"timeUnixNano": "1676809320000000000", "timeUnixNano": "1676809320000000000",
"count": "1", "count": "1",
"sum": "2.0", "sum": "5.0",
"quantileValues": [ "quantileValues": [
{ {
"value": 5.0
}, },
{ {
"quantile": 1.0 "quantile": 1.0,
"value": 5.0
} }
], ],
"attributes": [ "attributes": [
...@@ -428,12 +432,14 @@ ...@@ -428,12 +432,14 @@
"startTimeUnixNano": "1676809260000000000", "startTimeUnixNano": "1676809260000000000",
"timeUnixNano": "1676809320000000000", "timeUnixNano": "1676809320000000000",
"count": "1", "count": "1",
"sum": "2.0", "sum": "5.0",
"quantileValues": [ "quantileValues": [
{ {
"value": 5.0
}, },
{ {
"quantile": 1.0 "quantile": 1.0,
"value": 5.0
} }
], ],
"attributes": [ "attributes": [
...@@ -466,6 +472,104 @@ ...@@ -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", "name": "amazonaws.com/AWS/DynamoDB/UserErrors",
"unit": "{Count}", "unit": "{Count}",
...@@ -478,9 +582,11 @@ ...@@ -478,9 +582,11 @@
"sum": "2.0", "sum": "2.0",
"quantileValues": [ "quantileValues": [
{ {
"value": 2.0
}, },
{ {
"quantile": 1.0 "quantile": 1.0,
"value": 2.0
} }
], ],
"attributes": [ "attributes": [
...@@ -519,9 +625,11 @@ ...@@ -519,9 +625,11 @@
"sum": "2.0", "sum": "2.0",
"quantileValues": [ "quantileValues": [
{ {
"value": 2.0
}, },
{ {
"quantile": 1.0 "quantile": 1.0,
"value": 2.0
} }
], ],
"attributes": [ "attributes": [
...@@ -542,6 +650,61 @@ ...@@ -542,6 +650,61 @@
"value": { "value": {
"stringValue": "test" "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 @@ ...@@ -22,7 +22,7 @@
expected: expected/instance.yml expected: expected/instance.yml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql endpoint ls --service-name=aws-eks-cluster::SkyWalking - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql endpoint ls --service-name=aws-eks-cluster::SkyWalking
expected: expected/endpoint.yml 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 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' - - 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 expected: expected/metrics-has-value.yml
...@@ -15,5 +15,5 @@ ...@@ -15,5 +15,5 @@
{{- contains . }} {{- contains . }}
- key: {{ notEmpty .key }} - key: {{ notEmpty .key }}
value: {{ ge .value 0 }} value: {{ gt .value 0 }}
{{- end }} {{- end }}
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
"dataPoints": [ "dataPoints": [
{ {
"timeUnixNano": "1669442684150753695", "timeUnixNano": "1669442684150753695",
"asDouble": 0 "asDouble": 80
} }
] ]
} }
......
...@@ -15,5 +15,5 @@ ...@@ -15,5 +15,5 @@
{{- contains . }} {{- contains . }}
- key: {{ notEmpty .key }} - key: {{ notEmpty .key }}
value: {{ ge .value 0 }} value: {{ gt .value 0 }}
{{- end }} {{- end }}
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
"startTimeUnixNano": "1674547500000000000", "startTimeUnixNano": "1674547500000000000",
"timeUnixNano": "1674547560000000000", "timeUnixNano": "1674547560000000000",
"count": "1", "count": "1",
"sum": "5",
"quantileValues": [ "quantileValues": [
{ {
}, },
...@@ -87,6 +88,7 @@ ...@@ -87,6 +88,7 @@
"startTimeUnixNano": "1674547500000000000", "startTimeUnixNano": "1674547500000000000",
"timeUnixNano": "1674547560000000000", "timeUnixNano": "1674547560000000000",
"count": "1", "count": "1",
"sum": "5",
"quantileValues": [ "quantileValues": [
{ {
}, },
......
...@@ -18,30 +18,30 @@ ...@@ -18,30 +18,30 @@
value: value:
{{- contains .value }} {{- contains .value }}
- key: {{ notEmpty .key }} - key: {{ notEmpty .key }}
value: {{ ge .value 0 }} value: {{ gt .value 0 }}
{{- end }} {{- end }}
- key: 1 - key: 1
value: value:
{{- contains .value }} {{- contains .value }}
- key: {{ notEmpty .key }} - key: {{ notEmpty .key }}
value: {{ ge .value 0 }} value: {{ gt .value 0 }}
{{- end }} {{- end }}
- key: 2 - key: 2
value: value:
{{- contains .value }} {{- contains .value }}
- key: {{ notEmpty .key }} - key: {{ notEmpty .key }}
value: {{ ge .value 0 }} value: {{ gt .value 0 }}
{{- end }} {{- end }}
- key: 3 - key: 3
value: value:
{{- contains .value }} {{- contains .value }}
- key: {{ notEmpty .key }} - key: {{ notEmpty .key }}
value: {{ ge .value 0 }} value: {{ gt .value 0 }}
{{- end }} {{- end }}
- key: 4 - key: 4
value: value:
{{- contains .value }} {{- contains .value }}
- key: {{ notEmpty .key }} - key: {{ notEmpty .key }}
value: {{ ge .value 0 }} value: {{ gt .value 0 }}
{{- end }} {{- end }}
{{- 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 @@ ...@@ -35,7 +35,7 @@
# virtual cache # virtual cache
- query: | - 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' - 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: | - 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' - 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 expected: expected/metrics-has-value.yml
...@@ -48,4 +48,4 @@ ...@@ -48,4 +48,4 @@
# virtual database # virtual database
- query: | - 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' - 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 expected: expected/metrics-has-value.yml
\ No newline at end of file \ No newline at end of file
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
expected: expected/service-endpoint.yml expected: expected/service-endpoint.yml
# endpoint metrics # 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' - - 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 # 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' - - 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 expected: expected/metrics-has-value.yml
\ No newline at end of file \ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
{{- contains . }} {{- contains . }}
- key: {{ notEmpty .key }} - key: {{ notEmpty .key }}
value: {{ ge .value 0 }} value: {{ ge .value 1 }}
{{- end }} {{- end }}
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
# This file is used to show how to write configuration files and can be used to test. # This file is used to show how to write configuration files and can be used to test.
cases: cases:
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
expected: expected/service.yml 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' - - 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 expected: expected/metrics-has-value.yml
...@@ -89,7 +89,7 @@ public class OtelMetricsSender { ...@@ -89,7 +89,7 @@ public class OtelMetricsSender {
} }
private String rewriteTimeField(File file) throws IOException { private String rewriteTimeField(File file) throws IOException {
final long nanoTime = System.nanoTime(); final long nanoTime = System.currentTimeMillis() * 1000000L;
final Configuration configuration = Configuration.builder() final Configuration configuration = Configuration.builder()
.options(Option.SUPPRESS_EXCEPTIONS) .options(Option.SUPPRESS_EXCEPTIONS)
.evaluationListener(found -> { .evaluationListener(found -> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册