Skip to content

Commit

Permalink
PMM-9825 Use username instead of userid for PGSM 2.0. (#2718)
Browse files Browse the repository at this point in the history
  • Loading branch information
BupycHuk authored Jan 8, 2024
1 parent 9a62d90 commit 0da709d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions agent/agents/postgres/pgstatmonitor/pgstatmonitor_models.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ func newPgStatMonitorStructs(vPGSM pgStatMonitorVersion, vPG pgVersion) (*pgStat
// versions older than 0.8
fields = append(fields,
field{info: parse.FieldInfo{Name: "Relations", Type: "pq.StringArray", Column: "tables_names"}, pointer: &s.Relations},
field{info: parse.FieldInfo{Name: "DBID", Type: "int64", Column: "dbid"}, pointer: &s.DBID},
field{info: parse.FieldInfo{Name: "UserID", Type: "int64", Column: "userid"}, pointer: &s.UserID})
field{info: parse.FieldInfo{Name: "DBID", Type: "int64", Column: "dbid"}, pointer: &s.DBID})
}
if vPGSM <= pgStatMonitorVersion08 || vPGSM >= pgStatMonitorVersion20PG12 {
fields = append(fields,
Expand Down Expand Up @@ -214,10 +213,12 @@ func newPgStatMonitorStructs(vPGSM pgStatMonitorVersion, vPG pgVersion) (*pgStat

if vPGSM >= pgStatMonitorVersion08 && vPGSM < pgStatMonitorVersion20PG12 {
fields = append(fields,
field{info: parse.FieldInfo{Name: "BucketStartTimeString", Type: "string", Column: "bucket_start_time"}, pointer: &s.BucketStartTimeString})
field{info: parse.FieldInfo{Name: "BucketStartTimeString", Type: "string", Column: "bucket_start_time"}, pointer: &s.BucketStartTimeString},
field{info: parse.FieldInfo{Name: "UserName", Type: "string", Column: "userid"}, pointer: &s.UserName})
} else {
fields = append(fields,
field{info: parse.FieldInfo{Name: "BucketStartTime", Type: "time.Time", Column: "bucket_start_time"}, pointer: &s.BucketStartTime})
field{info: parse.FieldInfo{Name: "BucketStartTime", Type: "time.Time", Column: "bucket_start_time"}, pointer: &s.BucketStartTime},
field{info: parse.FieldInfo{Name: "UserName", Type: "string", Column: "username"}, pointer: &s.UserName})
}

s.pointers = make([]interface{}, len(fields))
Expand Down

0 comments on commit 0da709d

Please sign in to comment.