-
Notifications
You must be signed in to change notification settings - Fork 229
PMM-9630 Use status, status_code only for some versions. #912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3ac854a
4ff36c4
801ce30
85183ce
dfbc797
ee020fd
afbc284
e41a13a
15ed8b9
7a972ff
f4062de
a3a2119
666a236
e4769af
fb205ba
8292912
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,12 @@ const ( | |
| pgStatMonitorVersion10PG12 | ||
| pgStatMonitorVersion10PG13 | ||
| pgStatMonitorVersion10PG14 | ||
| pgStatMonitorVersion11PG12 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. new variables are not added to this function https://github.com/percona/pmm/pull/912/files#diff-ae12be77883993fc7d2b5ebc501e2fb0b0078ea1d4645c2f9327095ae0661d30R153
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added. |
||
| pgStatMonitorVersion11PG13 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci-lint] reported by reviewdog 🐶 |
||
| pgStatMonitorVersion11PG14 | ||
| pgStatMonitorVersion20PG12 | ||
| pgStatMonitorVersion20PG13 | ||
| pgStatMonitorVersion20PG14 | ||
| ) | ||
|
|
||
| const ( | ||
|
|
@@ -165,6 +171,26 @@ func getPGMonitorVersion(q *reform.Querier) (pgStatMonitorVersion, pgStatMonitor | |
|
|
||
| version := pgStatMonitorVersion06 | ||
| switch { | ||
| case pgsmVersion.Core().GreaterThanOrEqual(v20): | ||
| if pgVersion >= 14 { | ||
| version = pgStatMonitorVersion20PG14 | ||
| break | ||
| } | ||
| if pgVersion >= 13 { | ||
| version = pgStatMonitorVersion20PG13 | ||
| break | ||
| } | ||
| version = pgStatMonitorVersion20PG12 | ||
| case pgsmVersion.Core().GreaterThanOrEqual(v11): | ||
| if pgVersion >= 14 { | ||
| version = pgStatMonitorVersion11PG14 | ||
| break | ||
| } | ||
| if pgVersion >= 13 { | ||
| version = pgStatMonitorVersion11PG13 | ||
| break | ||
| } | ||
| version = pgStatMonitorVersion11PG12 | ||
| case pgsmVersion.Core().GreaterThanOrEqual(v10): | ||
| if pgVersion >= 14 { | ||
| version = pgStatMonitorVersion10PG14 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,9 @@ import ( | |
| ) | ||
|
|
||
| var ( | ||
| v10 = version.Must(version.NewVersion("1.0.0-beta-2")) | ||
| v20 = version.Must(version.NewVersion("2.0.0")) | ||
| v11 = version.Must(version.NewVersion("1.1.0")) | ||
| v10 = version.Must(version.NewVersion("1.0.0")) | ||
| v09 = version.Must(version.NewVersion("0.9")) | ||
| v08 = version.Must(version.NewVersion("0.8")) | ||
| ) | ||
|
|
@@ -82,13 +84,6 @@ type pgStatMonitor struct { | |
| WalRecords int64 | ||
| WalFpi int64 | ||
| WalBytes int64 | ||
| // state_code = 0 state 'PARSING' | ||
| // state_code = 1 state 'PLANNING' | ||
| // state_code = 2 state 'ACTIVE' | ||
| // state_code = 3 state 'FINISHED' | ||
| // state_code = 4 state 'FINISHED WITH ERROR' | ||
| StateCode int64 | ||
| State string | ||
|
|
||
| // < pg0.6 | ||
|
|
||
|
|
@@ -179,9 +174,7 @@ func NewPgStatMonitorStructs(v pgStatMonitorVersion) (*pgStatMonitor, reform.Vie | |
| field{info: parse.FieldInfo{Name: "Message", Type: "*string", Column: "message"}, pointer: &s.Message}, | ||
| field{info: parse.FieldInfo{Name: "WalRecords", Type: "int64", Column: "wal_records"}, pointer: &s.WalRecords}, | ||
| field{info: parse.FieldInfo{Name: "WalFpi", Type: "int64", Column: "wal_fpi"}, pointer: &s.WalFpi}, | ||
| field{info: parse.FieldInfo{Name: "WalBytes", Type: "int64", Column: "wal_bytes"}, pointer: &s.WalBytes}, | ||
| field{info: parse.FieldInfo{Name: "StateCode", Type: "int64", Column: "state_code"}, pointer: &s.StateCode}, | ||
| field{info: parse.FieldInfo{Name: "State", Type: "string", Column: "state"}, pointer: &s.State}) | ||
| field{info: parse.FieldInfo{Name: "WalBytes", Type: "int64", Column: "wal_bytes"}, pointer: &s.WalBytes}) | ||
| } | ||
|
|
||
| if v <= pgStatMonitorVersion10PG12 { | ||
|
|
@@ -257,7 +250,7 @@ func (v *pgStatMonitorAllViewType) NewStruct() reform.Struct { | |
|
|
||
| // String returns a string representation of this struct or record. | ||
| func (s pgStatMonitor) String() string { | ||
| res := make([]string, 51) | ||
| res := make([]string, 49) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci-lint] reported by reviewdog 🐶 |
||
| res[0] = "Bucket: " + reform.Inspect(s.Bucket, true) | ||
| res[1] = "BucketStartTime: " + reform.Inspect(s.BucketStartTime, true) | ||
| res[2] = "UserID: " + reform.Inspect(s.UserID, true) | ||
|
|
@@ -307,8 +300,6 @@ func (s pgStatMonitor) String() string { | |
| res[46] = "WalRecords: " + reform.Inspect(s.WalRecords, true) | ||
| res[47] = "WalFpi: " + reform.Inspect(s.WalFpi, true) | ||
| res[48] = "WalBytes: " + reform.Inspect(s.WalBytes, true) | ||
| res[49] = "StateCode: " + reform.Inspect(s.StateCode, true) | ||
| res[50] = "State: " + reform.Inspect(s.State, true) | ||
| return strings.Join(res, ", ") | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
pgStatMonitorVersion11PG12is unused (deadcode)