wu-sheng commented on code in PR #9725:
URL: https://github.com/apache/skywalking/pull/9725#discussion_r985261710


##########
oap-server/server-starter/src/main/resources/otel-rules/apisix.yaml:
##########
@@ -0,0 +1,68 @@
+# 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 will parse a textual representation of a duration. The formats
+# accepted are based on the ISO-8601 duration format {@code PnDTnHnMn.nS}
+# with days considered to be exactly 24 hours.
+# <p>
+# Examples:
+# <pre>
+#    "PT20.345S" -- parses as "20.345 seconds"
+#    "PT15M"     -- parses as "15 minutes" (where a minute is 60 seconds)
+#    "PT10H"     -- parses as "10 hours" (where an hour is 3600 seconds)
+#    "P2D"       -- parses as "2 days" (where a day is 24 hours or 86400 
seconds)
+#    "P2DT3H4M"  -- parses as "2 days, 3 hours and 4 minutes"
+#    "P-6H3M"    -- parses as "-6 hours and +3 minutes"
+#    "-P6H3M"    -- parses as "-6 hours and -3 minutes"
+#    "-P-6H+3M"  -- parses as "+6 hours and -3 minutes"
+# </pre>
+filter: "{ tags -> tags.job_name == 'apisix-monitoring' }" # The OpenTelemetry 
job name
+expPrefix:  tag({tags -> tags.host_name = 'apisix::' + 
tags.service_instance_id})
+expSuffix:
+metricPrefix: meter_apisix
+metricsRules:
+  # apisix
+  - name: sv_http_connections
+    exp: 
apisix_nginx_http_current_connections.sum(['state','host_name']).service(['host_name']
 , Layer.APISIX)
+  - name: shared_dict_capacity_bytes
+    exp: 
apisix_shared_dict_capacity_bytes.sum(['name','host_name']).service(['host_name']
 , Layer.APISIX)
+  - name: shared_dict_free_space_bytes
+    exp: 
apisix_shared_dict_free_space_bytes.sum(['name','host_name']).service(['host_name']
 , Layer.APISIX)
+  - name: sv_etcd_indexes
+    exp: 
apisix_etcd_modify_indexes.sum(['key','host_name']).service(['host_name'] , 
Layer.APISIX)
+  - name: sv_bandwidth
+    exp: 
apisix_bandwidth.tagEqual('route','').tagEqual('service','').tagEqual('consumer','').tagEqual('node','').sum(['type','host_name']).rate('PT1M').service(['host_name']
 , Layer.APISIX)
+  - name: sv_http_status
+    exp: 
apisix_http_status.tagEqual('route','').tagEqual('matched_uri','').tagEqual('matched_host','').tagEqual('service','').tagEqual('consumer','').tagEqual('node','').sum(['code','host_name']).rate('PT1M').service(['host_name']
 , Layer.APISIX)

Review Comment:
   Let's go back to the original, why 404 matters? 
   
   This is a gateway, so, unless the firewall blocks some IPs(such as DDoS), 
most likely, every client/browser could access any URI randomly. 404 is just a 
code but doesn't represent the health status.



##########
oap-server/server-starter/src/main/resources/otel-rules/apisix.yaml:
##########
@@ -0,0 +1,68 @@
+# 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 will parse a textual representation of a duration. The formats
+# accepted are based on the ISO-8601 duration format {@code PnDTnHnMn.nS}
+# with days considered to be exactly 24 hours.
+# <p>
+# Examples:
+# <pre>
+#    "PT20.345S" -- parses as "20.345 seconds"
+#    "PT15M"     -- parses as "15 minutes" (where a minute is 60 seconds)
+#    "PT10H"     -- parses as "10 hours" (where an hour is 3600 seconds)
+#    "P2D"       -- parses as "2 days" (where a day is 24 hours or 86400 
seconds)
+#    "P2DT3H4M"  -- parses as "2 days, 3 hours and 4 minutes"
+#    "P-6H3M"    -- parses as "-6 hours and +3 minutes"
+#    "-P6H3M"    -- parses as "-6 hours and -3 minutes"
+#    "-P-6H+3M"  -- parses as "+6 hours and -3 minutes"
+# </pre>
+filter: "{ tags -> tags.job_name == 'apisix-monitoring' }" # The OpenTelemetry 
job name
+expPrefix:  tag({tags -> tags.host_name = 'apisix::' + 
tags.service_instance_id})
+expSuffix:
+metricPrefix: meter_apisix
+metricsRules:
+  # apisix
+  - name: sv_http_connections
+    exp: 
apisix_nginx_http_current_connections.sum(['state','host_name']).service(['host_name']
 , Layer.APISIX)
+  - name: shared_dict_capacity_bytes
+    exp: 
apisix_shared_dict_capacity_bytes.sum(['name','host_name']).service(['host_name']
 , Layer.APISIX)
+  - name: shared_dict_free_space_bytes
+    exp: 
apisix_shared_dict_free_space_bytes.sum(['name','host_name']).service(['host_name']
 , Layer.APISIX)
+  - name: sv_etcd_indexes
+    exp: 
apisix_etcd_modify_indexes.sum(['key','host_name']).service(['host_name'] , 
Layer.APISIX)
+  - name: sv_bandwidth
+    exp: 
apisix_bandwidth.tagEqual('route','').tagEqual('service','').tagEqual('consumer','').tagEqual('node','').sum(['type','host_name']).rate('PT1M').service(['host_name']
 , Layer.APISIX)
+  - name: sv_http_status
+    exp: 
apisix_http_status.tagEqual('route','').tagEqual('matched_uri','').tagEqual('matched_host','').tagEqual('service','').tagEqual('consumer','').tagEqual('node','').sum(['code','host_name']).rate('PT1M').service(['host_name']
 , Layer.APISIX)

Review Comment:
   `rate('PT1M')` for a counter only means what the increase/decrease rate of 
this metric in the past one minute is. It has no logic connection about the 
percentage of 404 in all requests. Also, as my previous comments, even it is 
the percentage, 404 actually doesn't have real meaning to measure server 
performance.



##########
oap-server/server-starter/src/main/resources/otel-rules/apisix.yaml:
##########
@@ -0,0 +1,68 @@
+# 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 will parse a textual representation of a duration. The formats
+# accepted are based on the ISO-8601 duration format {@code PnDTnHnMn.nS}
+# with days considered to be exactly 24 hours.
+# <p>
+# Examples:
+# <pre>
+#    "PT20.345S" -- parses as "20.345 seconds"
+#    "PT15M"     -- parses as "15 minutes" (where a minute is 60 seconds)
+#    "PT10H"     -- parses as "10 hours" (where an hour is 3600 seconds)
+#    "P2D"       -- parses as "2 days" (where a day is 24 hours or 86400 
seconds)
+#    "P2DT3H4M"  -- parses as "2 days, 3 hours and 4 minutes"
+#    "P-6H3M"    -- parses as "-6 hours and +3 minutes"
+#    "-P6H3M"    -- parses as "-6 hours and -3 minutes"
+#    "-P-6H+3M"  -- parses as "+6 hours and -3 minutes"
+# </pre>
+filter: "{ tags -> tags.job_name == 'apisix-monitoring' }" # The OpenTelemetry 
job name
+expPrefix:  tag({tags -> tags.host_name = 'apisix::' + 
tags.service_instance_id})
+expSuffix:
+metricPrefix: meter_apisix
+metricsRules:
+  # apisix
+  - name: sv_http_connections
+    exp: 
apisix_nginx_http_current_connections.sum(['state','host_name']).service(['host_name']
 , Layer.APISIX)
+  - name: shared_dict_capacity_bytes
+    exp: 
apisix_shared_dict_capacity_bytes.sum(['name','host_name']).service(['host_name']
 , Layer.APISIX)
+  - name: shared_dict_free_space_bytes
+    exp: 
apisix_shared_dict_free_space_bytes.sum(['name','host_name']).service(['host_name']
 , Layer.APISIX)
+  - name: sv_etcd_indexes
+    exp: 
apisix_etcd_modify_indexes.sum(['key','host_name']).service(['host_name'] , 
Layer.APISIX)
+  - name: sv_bandwidth
+    exp: 
apisix_bandwidth.tagEqual('route','').tagEqual('service','').tagEqual('consumer','').tagEqual('node','').sum(['type','host_name']).rate('PT1M').service(['host_name']
 , Layer.APISIX)
+  - name: sv_http_status
+    exp: 
apisix_http_status.tagEqual('route','').tagEqual('matched_uri','').tagEqual('matched_host','').tagEqual('service','').tagEqual('consumer','').tagEqual('node','').sum(['code','host_name']).rate('PT1M').service(['host_name']
 , Layer.APISIX)

Review Comment:
   Does `apisix_http_status` include all response codes? Or just some >= 300?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to