diff --git a/models/stick_table.go b/models/stick_table.go index 1d233d37..5a9ed4c8 100644 --- a/models/stick_table.go +++ b/models/stick_table.go @@ -213,8 +213,8 @@ func (m *StickTable) UnmarshalBinary(b []byte) error { // swagger:model StickTableField type StickTableField struct { // field - // Enum: ["bytes_in_cnt","bytes_in_rate","bytes_out_cnt","bytes_out_rate","conn_cnt","conn_cur","conn_rate","gpc0","gpc0_rate","gpc1","gpc1_rate","gpt0","http_req_cnt","http_req_rate","http_err_cnt","http_err_rate","server_id","sess_cnt","sess_rate"] - // +kubebuilder:validation:Enum=bytes_in_cnt;bytes_in_rate;bytes_out_cnt;bytes_out_rate;conn_cnt;conn_cur;conn_rate;gpc0;gpc0_rate;gpc1;gpc1_rate;gpt0;http_req_cnt;http_req_rate;http_err_cnt;http_err_rate;server_id;sess_cnt;sess_rate; + // Enum: ["bytes_in_cnt","bytes_in_rate","bytes_out_cnt","bytes_out_rate","conn_cnt","conn_cur","conn_rate","gpc0","gpc0_rate","gpc1","gpc1_rate","gpt0","http_req_cnt","http_req_rate","http_err_cnt","http_err_rate","server_id","sess_cnt","sess_rate","glitch_rate","glitch_cnt"] + // +kubebuilder:validation:Enum=bytes_in_cnt;bytes_in_rate;bytes_out_cnt;bytes_out_rate;conn_cnt;conn_cur;conn_rate;gpc0;gpc0_rate;gpc1;gpc1_rate;gpt0;http_req_cnt;http_req_rate;http_err_cnt;http_err_rate;server_id;sess_cnt;sess_rate;glitch_rate;glitch_cnt; Field string `json:"field,omitempty"` // period @@ -248,7 +248,7 @@ var stickTableFieldTypeFieldPropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["bytes_in_cnt","bytes_in_rate","bytes_out_cnt","bytes_out_rate","conn_cnt","conn_cur","conn_rate","gpc0","gpc0_rate","gpc1","gpc1_rate","gpt0","http_req_cnt","http_req_rate","http_err_cnt","http_err_rate","server_id","sess_cnt","sess_rate"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["bytes_in_cnt","bytes_in_rate","bytes_out_cnt","bytes_out_rate","conn_cnt","conn_cur","conn_rate","gpc0","gpc0_rate","gpc1","gpc1_rate","gpt0","http_req_cnt","http_req_rate","http_err_cnt","http_err_rate","server_id","sess_cnt","sess_rate","glitch_rate","glitch_cnt"]`), &res); err != nil { panic(err) } for _, v := range res { @@ -314,6 +314,12 @@ const ( // StickTableFieldFieldSessRate captures enum value "sess_rate" StickTableFieldFieldSessRate string = "sess_rate" + + // StickTableFieldFieldGlitchRate captures enum value "glitch_rate" + StickTableFieldFieldGlitchRate string = "glitch_rate" + + // StickTableFieldFieldGlitchCnt captures enum value "glitch_cnt" + StickTableFieldFieldGlitchCnt string = "glitch_cnt" ) // prop value enum diff --git a/models/stick_table_entry.go b/models/stick_table_entry.go index 4ea1f1b8..e50621c3 100644 --- a/models/stick_table_entry.go +++ b/models/stick_table_entry.go @@ -58,6 +58,12 @@ type StickTableEntry struct { // exp Exp *int64 `json:"exp,omitempty"` + // glitch cnt + GlitchCnt *int64 `json:"glitch_cnt,omitempty"` + + // glitch rate + GlitchRate *int64 `json:"glitch_rate,omitempty"` + // gpc0 Gpc0 *int64 `json:"gpc0,omitempty"` diff --git a/models/stick_table_entry_compare.go b/models/stick_table_entry_compare.go index 185cdf17..a4eca070 100644 --- a/models/stick_table_entry_compare.go +++ b/models/stick_table_entry_compare.go @@ -56,6 +56,14 @@ func (s StickTableEntry) Equal(t StickTableEntry, opts ...Options) bool { return false } + if !equalPointers(s.GlitchCnt, t.GlitchCnt) { + return false + } + + if !equalPointers(s.GlitchRate, t.GlitchRate) { + return false + } + if !equalPointers(s.Gpc0, t.Gpc0) { return false } @@ -159,6 +167,14 @@ func (s StickTableEntry) Diff(t StickTableEntry, opts ...Options) map[string][]i diff["Exp"] = []interface{}{ValueOrNil(s.Exp), ValueOrNil(t.Exp)} } + if !equalPointers(s.GlitchCnt, t.GlitchCnt) { + diff["GlitchCnt"] = []interface{}{ValueOrNil(s.GlitchCnt), ValueOrNil(t.GlitchCnt)} + } + + if !equalPointers(s.GlitchRate, t.GlitchRate) { + diff["GlitchRate"] = []interface{}{ValueOrNil(s.GlitchRate), ValueOrNil(t.GlitchRate)} + } + if !equalPointers(s.Gpc0, t.Gpc0) { diff["Gpc0"] = []interface{}{ValueOrNil(s.Gpc0), ValueOrNil(t.Gpc0)} } diff --git a/models/stick_table_entry_compare_test.go b/models/stick_table_entry_compare_test.go index e46b5699..583e9088 100644 --- a/models/stick_table_entry_compare_test.go +++ b/models/stick_table_entry_compare_test.go @@ -94,6 +94,8 @@ func TestStickTableEntryEqualFalse(t *testing.T) { result.ConnCur = Ptr(*sample.ConnCur + 1) result.ConnRate = Ptr(*sample.ConnRate + 1) result.Exp = Ptr(*sample.Exp + 1) + result.GlitchCnt = Ptr(*sample.GlitchCnt + 1) + result.GlitchRate = Ptr(*sample.GlitchRate + 1) result.Gpc0 = Ptr(*sample.Gpc0 + 1) result.Gpc0Rate = Ptr(*sample.Gpc0Rate + 1) result.Gpc1 = Ptr(*sample.Gpc1 + 1) @@ -194,6 +196,8 @@ func TestStickTableEntryDiffFalse(t *testing.T) { result.ConnCur = Ptr(*sample.ConnCur + 1) result.ConnRate = Ptr(*sample.ConnRate + 1) result.Exp = Ptr(*sample.Exp + 1) + result.GlitchCnt = Ptr(*sample.GlitchCnt + 1) + result.GlitchRate = Ptr(*sample.GlitchRate + 1) result.Gpc0 = Ptr(*sample.Gpc0 + 1) result.Gpc0Rate = Ptr(*sample.Gpc0Rate + 1) result.Gpc1 = Ptr(*sample.Gpc1 + 1) @@ -214,7 +218,7 @@ func TestStickTableEntryDiffFalse(t *testing.T) { for _, sample := range samples { result := sample.a.Diff(sample.b) - if len(result) != 23 { + if len(result) != 25 { json := jsoniter.ConfigCompatibleWithStandardLibrary a, err := json.Marshal(&sample.a) if err != nil { @@ -224,7 +228,7 @@ func TestStickTableEntryDiffFalse(t *testing.T) { if err != nil { t.Errorf(err.Error()) } - t.Errorf("Expected StickTableEntry to be different in 23 cases, but it is not (%d) %s %s", len(result), a, b) + t.Errorf("Expected StickTableEntry to be different in 25 cases, but it is not (%d) %s %s", len(result), a, b) } } } diff --git a/runtime/stick_tables.go b/runtime/stick_tables.go index 6f4589fa..a7a07d3e 100644 --- a/runtime/stick_tables.go +++ b/runtime/stick_tables.go @@ -238,6 +238,16 @@ func parseStickTableEntry(output string) *models.StickTableEntry { //nolint:goco if err == nil { entry.BytesOutRate = &bytesOutRate } + case key == "glitch_cnt": + glitchCnt, err := strconv.ParseInt(strings.TrimSpace(v), 10, 64) + if err == nil { + entry.GlitchCnt = &glitchCnt + } + case strings.HasPrefix(key, "glitch_rate("): + glitchRate, err := strconv.ParseInt(strings.TrimSpace(v), 10, 64) + if err == nil { + entry.GlitchRate = &glitchRate + } case key == "use": entry.Use = strings.TrimSpace(v) == "1" case key == "exp": diff --git a/specification/build/haproxy_spec.yaml b/specification/build/haproxy_spec.yaml index aa2b38ef..4b51ec67 100644 --- a/specification/build/haproxy_spec.yaml +++ b/specification/build/haproxy_spec.yaml @@ -9447,6 +9447,8 @@ definitions: - server_id - sess_cnt - sess_rate + - glitch_rate + - glitch_cnt type: string period: type: integer @@ -9513,6 +9515,12 @@ definitions: exp: type: integer x-nullable: true + glitch_cnt: + type: integer + x-nullable: true + glitch_rate: + type: integer + x-nullable: true gpc0: type: integer x-nullable: true diff --git a/specification/models/runtime/table.yaml b/specification/models/runtime/table.yaml index 1608276b..7b2ea262 100644 --- a/specification/models/runtime/table.yaml +++ b/specification/models/runtime/table.yaml @@ -44,6 +44,8 @@ table: - server_id - sess_cnt - sess_rate + - glitch_rate + - glitch_cnt type: type: string enum: [rate, counter] diff --git a/specification/models/runtime/table_entry.yaml b/specification/models/runtime/table_entry.yaml index dd77e68d..6474fd32 100644 --- a/specification/models/runtime/table_entry.yaml +++ b/specification/models/runtime/table_entry.yaml @@ -70,3 +70,9 @@ table_entry: x-nullable: true use: type: boolean + glitch_cnt: + type: integer + x-nullable: true + glitch_rate: + type: integer + x-nullable: true