summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2024-05-20 20:15:20 +0300
committerGitHub <noreply@github.com>2024-05-20 20:15:20 +0300
commit6fcda4c2c007ce9bd46dc7b2825acf5c61700200 (patch)
tree33e9b477331c49281869911ea3c639b5aea348a7
parent9cff2820d778b098ea12f4db5202ac3439bc08b4 (diff)
go.d weblog ignore reqProcTime on HTTP 101 (#17717)
-rw-r--r--src/go/collectors/go.d.plugin/modules/weblog/collect.go6
-rw-r--r--src/go/collectors/go.d.plugin/modules/weblog/weblog_test.go90
2 files changed, 50 insertions, 46 deletions
diff --git a/src/go/collectors/go.d.plugin/modules/weblog/collect.go b/src/go/collectors/go.d.plugin/modules/weblog/collect.go
index d246207749..fd7993f26e 100644
--- a/src/go/collectors/go.d.plugin/modules/weblog/collect.go
+++ b/src/go/collectors/go.d.plugin/modules/weblog/collect.go
@@ -5,6 +5,7 @@ package weblog
import (
"fmt"
"io"
+ "net/http"
"runtime"
"strconv"
"strings"
@@ -76,6 +77,10 @@ func (w *WebLog) collectLogLines() (int, error) {
}
func (w *WebLog) collectLogLine() {
+ // https://github.com/netdata/netdata/issues/17716
+ if w.line.hasReqProcTime() && w.line.respCode == http.StatusSwitchingProtocols {
+ w.line.reqProcTime = emptyNumber
+ }
w.mx.Requests.Inc()
w.collectVhost()
w.collectPort()
@@ -309,7 +314,6 @@ func (w *WebLog) collectURLPatternStats(name string) {
if w.line.hasRespSize() {
v.BytesSent.Add(float64(w.line.respSize))
}
-
if w.line.hasReqProcTime() {
v.ReqProcTime.Observe(w.line.reqProcTime)
}
diff --git a/src/go/collectors/go.d.plugin/modules/weblog/weblog_test.go b/src/go/collectors/go.d.plugin/modules/weblog/weblog_test.go
index ddeaae38b5..a756b6fb5f 100644
--- a/src/go/collectors/go.d.plugin/modules/weblog/weblog_test.go
+++ b/src/go/collectors/go.d.plugin/modules/weblog/weblog_test.go
@@ -140,6 +140,24 @@ func TestWebLog_Collect(t *testing.T) {
"custom_field_drink_wine": 231,
"custom_field_side_dark": 231,
"custom_field_side_light": 221,
+ "custom_time_field_random_time_field_time_avg": 230,
+ "custom_time_field_random_time_field_time_count": 452,
+ "custom_time_field_random_time_field_time_hist_bucket_1": 452,
+ "custom_time_field_random_time_field_time_hist_bucket_10": 452,
+ "custom_time_field_random_time_field_time_hist_bucket_11": 452,
+ "custom_time_field_random_time_field_time_hist_bucket_2": 452,
+ "custom_time_field_random_time_field_time_hist_bucket_3": 452,
+ "custom_time_field_random_time_field_time_hist_bucket_4": 452,
+ "custom_time_field_random_time_field_time_hist_bucket_5": 452,
+ "custom_time_field_random_time_field_time_hist_bucket_6": 452,
+ "custom_time_field_random_time_field_time_hist_bucket_7": 452,
+ "custom_time_field_random_time_field_time_hist_bucket_8": 452,
+ "custom_time_field_random_time_field_time_hist_bucket_9": 452,
+ "custom_time_field_random_time_field_time_hist_count": 452,
+ "custom_time_field_random_time_field_time_hist_sum": 103960,
+ "custom_time_field_random_time_field_time_max": 230,
+ "custom_time_field_random_time_field_time_min": 230,
+ "custom_time_field_random_time_field_time_sum": 103960,
"req_http_scheme": 218,
"req_https_scheme": 234,
"req_ipv4": 275,
@@ -152,24 +170,24 @@ func TestWebLog_Collect(t *testing.T) {
"req_port_82": 84,
"req_port_83": 85,
"req_port_84": 87,
- "req_proc_time_avg": 247,
- "req_proc_time_count": 452,
- "req_proc_time_hist_bucket_1": 452,
- "req_proc_time_hist_bucket_10": 452,
- "req_proc_time_hist_bucket_11": 452,
- "req_proc_time_hist_bucket_2": 452,
- "req_proc_time_hist_bucket_3": 452,
- "req_proc_time_hist_bucket_4": 452,
- "req_proc_time_hist_bucket_5": 452,
- "req_proc_time_hist_bucket_6": 452,
- "req_proc_time_hist_bucket_7": 452,
- "req_proc_time_hist_bucket_8": 452,
- "req_proc_time_hist_bucket_9": 452,
- "req_proc_time_hist_count": 452,
- "req_proc_time_hist_sum": 111927,
- "req_proc_time_max": 499,
+ "req_proc_time_avg": 244,
+ "req_proc_time_count": 402,
+ "req_proc_time_hist_bucket_1": 402,
+ "req_proc_time_hist_bucket_10": 402,
+ "req_proc_time_hist_bucket_11": 402,
+ "req_proc_time_hist_bucket_2": 402,
+ "req_proc_time_hist_bucket_3": 402,
+ "req_proc_time_hist_bucket_4": 402,
+ "req_proc_time_hist_bucket_5": 402,
+ "req_proc_time_hist_bucket_6": 402,
+ "req_proc_time_hist_bucket_7": 402,
+ "req_proc_time_hist_bucket_8": 402,
+ "req_proc_time_hist_bucket_9": 402,
+ "req_proc_time_hist_count": 402,
+ "req_proc_time_hist_sum": 98312,
+ "req_proc_time_max": 497,
"req_proc_time_min": 2,
- "req_proc_time_sum": 111927,
+ "req_proc_time_sum": 98312,
"req_ssl_cipher_suite_AES256-SHA": 101,
"req_ssl_cipher_suite_DHE-RSA-AES256-SHA": 111,
"req_ssl_cipher_suite_ECDHE-RSA-AES256-SHA": 127,
@@ -236,11 +254,11 @@ func TestWebLog_Collect(t *testing.T) {
"url_ptn_com_req_method_GET": 38,
"url_ptn_com_req_method_HEAD": 39,
"url_ptn_com_req_method_POST": 43,
- "url_ptn_com_req_proc_time_avg": 212,
- "url_ptn_com_req_proc_time_count": 120,
+ "url_ptn_com_req_proc_time_avg": 209,
+ "url_ptn_com_req_proc_time_count": 105,
"url_ptn_com_req_proc_time_max": 495,
"url_ptn_com_req_proc_time_min": 5,
- "url_ptn_com_req_proc_time_sum": 25544,
+ "url_ptn_com_req_proc_time_sum": 22010,
"url_ptn_com_resp_code_100": 12,
"url_ptn_com_resp_code_101": 15,
"url_ptn_com_resp_code_200": 13,
@@ -254,11 +272,11 @@ func TestWebLog_Collect(t *testing.T) {
"url_ptn_net_req_method_GET": 51,
"url_ptn_net_req_method_HEAD": 33,
"url_ptn_net_req_method_POST": 32,
- "url_ptn_net_req_proc_time_avg": 260,
- "url_ptn_net_req_proc_time_count": 116,
- "url_ptn_net_req_proc_time_max": 499,
+ "url_ptn_net_req_proc_time_avg": 254,
+ "url_ptn_net_req_proc_time_count": 104,
+ "url_ptn_net_req_proc_time_max": 497,
"url_ptn_net_req_proc_time_min": 10,
- "url_ptn_net_req_proc_time_sum": 30221,
+ "url_ptn_net_req_proc_time_sum": 26510,
"url_ptn_net_resp_code_100": 16,
"url_ptn_net_resp_code_101": 12,
"url_ptn_net_resp_code_200": 16,
@@ -279,11 +297,11 @@ func TestWebLog_Collect(t *testing.T) {
"url_ptn_org_req_method_GET": 29,
"url_ptn_org_req_method_HEAD": 46,
"url_ptn_org_req_method_POST": 38,
- "url_ptn_org_req_proc_time_avg": 263,
- "url_ptn_org_req_proc_time_count": 113,
+ "url_ptn_org_req_proc_time_avg": 260,
+ "url_ptn_org_req_proc_time_count": 102,
"url_ptn_org_req_proc_time_max": 497,
"url_ptn_org_req_proc_time_min": 2,
- "url_ptn_org_req_proc_time_sum": 29796,
+ "url_ptn_org_req_proc_time_sum": 26599,
"url_ptn_org_resp_code_100": 15,
"url_ptn_org_resp_code_101": 11,
"url_ptn_org_resp_code_200": 20,
@@ -292,24 +310,6 @@ func TestWebLog_Collect(t *testing.T) {
"url_ptn_org_resp_code_301": 19,
"url_ptn_org_resp_code_400": 13,
"url_ptn_org_resp_code_401": 9,
- "custom_time_field_random_time_field_time_avg": 230,
- "custom_time_field_random_time_field_time_count": 452,
- "custom_time_field_random_time_field_time_hist_bucket_1": 452,
- "custom_time_field_random_time_field_time_hist_bucket_10": 452,
- "custom_time_field_random_time_field_time_hist_bucket_11": 452,
- "custom_time_field_random_time_field_time_hist_bucket_2": 452,
- "custom_time_field_random_time_field_time_hist_bucket_3": 452,
- "custom_time_field_random_time_field_time_hist_bucket_4": 452,
- "custom_time_field_random_time_field_time_hist_bucket_5": 452,
- "custom_time_field_random_time_field_time_hist_bucket_6": 452,
- "custom_time_field_random_time_field_time_hist_bucket_7": 452,
- "custom_time_field_random_time_field_time_hist_bucket_8": 452,
- "custom_time_field_random_time_field_time_hist_bucket_9": 452,
- "custom_time_field_random_time_field_time_hist_count": 452,
- "custom_time_field_random_time_field_time_hist_sum": 103960,
- "custom_time_field_random_time_field_time_max": 230,
- "custom_time_field_random_time_field_time_min": 230,
- "custom_time_field_random_time_field_time_sum": 103960,
}
mx := weblog.Collect()