This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new d6fc848e8b Calculate Nginx service HTTP Latency by MQE. (#12136)
d6fc848e8b is described below

commit d6fc848e8b13af202def8faba057ac63bed619b2
Author: weixiang1862 <[email protected]>
AuthorDate: Fri Apr 19 19:12:36 2024 +0800

    Calculate Nginx service HTTP Latency by MQE. (#12136)
---
 docs/en/changes/changes.md                         |  1 +
 .../resources/otel-rules/nginx/nginx-service.yaml  |  2 +-
 .../nginx/nginx-service.json                       |  2 +-
 test/e2e-v2/cases/nginx/e2e.yaml                   |  2 +-
 ...-value-label-percentile-service_instance_id.yml | 37 ++++++++++++++++++++++
 5 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 9a6b2f9b0e..6b0a0a70d1 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -110,6 +110,7 @@
 * Support Apache ActiveMQ server monitoring. 
 * Add Service Hierarchy auto matching layer relationships (upper -> lower) as 
following:
   - ACTIVEMQ -> K8S_SERVICE
+* Calculate Nginx service HTTP Latency by MQE.
 
 #### UI
 
diff --git 
a/oap-server/server-starter/src/main/resources/otel-rules/nginx/nginx-service.yaml
 
b/oap-server/server-starter/src/main/resources/otel-rules/nginx/nginx-service.yaml
index 78d82f9d37..0147b569af 100644
--- 
a/oap-server/server-starter/src/main/resources/otel-rules/nginx/nginx-service.yaml
+++ 
b/oap-server/server-starter/src/main/resources/otel-rules/nginx/nginx-service.yaml
@@ -36,7 +36,7 @@ metricsRules:
   - name: http_requests
     exp: 
nginx_http_requests_total.sum(['service','service_instance_id']).rate('PT1M')
   - name: http_latency
-    exp: 
nginx_http_latency.sum(['le','service']).histogram().histogram_percentile([50,70,90,99])
+    exp: 
nginx_http_latency.sum(['le','service','service_instance_id']).histogram().histogram_percentile([50,70,90,99])
   - name: http_bandwidth
     exp: 
nginx_http_size_bytes.sum(['type','service','service_instance_id']).rate('PT1M')
   - name: http_connections
diff --git 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-service.json
 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-service.json
index 9585468d9e..68d0304d4b 100644
--- 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-service.json
+++ 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/nginx/nginx-service.json
@@ -60,7 +60,7 @@
                     "showYAxis": true
                   },
                   "expressions": [
-                    "meter_nginx_service_http_latency"
+                    "aggregate_labels(meter_nginx_service_http_latency, 
avg(p))"
                   ]
                 },
                 {
diff --git a/test/e2e-v2/cases/nginx/e2e.yaml b/test/e2e-v2/cases/nginx/e2e.yaml
index 882354f229..1c55aee1de 100644
--- a/test/e2e-v2/cases/nginx/e2e.yaml
+++ b/test/e2e-v2/cases/nginx/e2e.yaml
@@ -49,7 +49,7 @@ verify:
     - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics exec 
--expression=meter_nginx_service_http_requests --service-name=nginx::e2e-test
       expected: expected/metrics-has-value-label-service_instance_id.yml
     - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics exec 
--expression=meter_nginx_service_http_latency --service-name=nginx::e2e-test
-      expected: expected/metrics-has-value-label-percentile.yml
+      expected: 
expected/metrics-has-value-label-percentile-service_instance_id.yml
     - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics exec 
--expression=meter_nginx_service_http_bandwidth --service-name=nginx::e2e-test
       expected: expected/metrics-has-value-label-type-service_instance_id.yml
     - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql metrics exec 
--expression=meter_nginx_service_http_connections --service-name=nginx::e2e-test
diff --git 
a/test/e2e-v2/cases/nginx/expected/metrics-has-value-label-percentile-service_instance_id.yml
 
b/test/e2e-v2/cases/nginx/expected/metrics-has-value-label-percentile-service_instance_id.yml
new file mode 100644
index 0000000000..b3a8249825
--- /dev/null
+++ 
b/test/e2e-v2/cases/nginx/expected/metrics-has-value-label-percentile-service_instance_id.yml
@@ -0,0 +1,37 @@
+# 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.
+
+type: TIME_SERIES_VALUES
+results:
+  {{- contains .results }}
+  - metric:
+      labels:
+        {{- contains .metric.labels }}
+        - key: p
+          value: {{ .value }}
+        - key: service_instance_id
+          value: {{ .value }}
+        {{- end}}
+    values:
+      {{- contains .values }}
+      - id: {{ notEmpty .id }}
+        value: {{ .value }}
+        traceid: null
+      - id: {{ notEmpty .id }}
+        value: null
+        traceid: null
+      {{- end}}
+  {{- end}}
+error: null

Reply via email to