From 06d5966106f5484f9f4a87cb3521ce73bdcca40e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C4=8Ctvrtka?= <62988319+JiriCtvrtka@users.noreply.github.com> Date: Mon, 23 Jun 2025 12:13:08 +0200 Subject: [PATCH] PMM-12548 Add json tags for PMM purposes. (#951) * PMM-12548 Add json tags for PMM purposes. * PMM-12548 Response length json tag. --- src/go/mongolib/proto/system.profile.go | 157 ++++++++++++------------ 1 file changed, 79 insertions(+), 78 deletions(-) diff --git a/src/go/mongolib/proto/system.profile.go b/src/go/mongolib/proto/system.profile.go index ea5a933a..0e50394e 100644 --- a/src/go/mongolib/proto/system.profile.go +++ b/src/go/mongolib/proto/system.profile.go @@ -8,103 +8,104 @@ import ( ) // docsExamined is renamed from nscannedObjects in 3.2.0 +// json tags are used for PMM purposes // https://docs.mongodb.com/manual/reference/database-profiler/#system.profile.docsExamined type SystemProfile struct { - AllUsers []interface{} `bson:"allUsers"` - Client string `bson:"client"` - CursorExhausted bool `bson:"cursorExhausted"` + AllUsers []interface{} `bson:"allUsers" json:"allUsers"` + Client string `bson:"client" json:"client"` + CursorExhausted bool `bson:"cursorExhausted" json:"cursorExhausted"` ExecStats struct { - Advanced int `bson:"advanced"` - ExecutionTimeMillisEstimate int `bson:"executionTimeMillisEstimate"` + Advanced int `bson:"advanced" json:"advanced"` + ExecutionTimeMillisEstimate int `bson:"executionTimeMillisEstimate" json:"executionTimeMillisEstimate"` InputStage struct { - Advanced int `bson:"advanced"` - Direction string `bson:"direction"` - DocsExamined int `bson:"docsExamined"` - ExecutionTimeMillisEstimate int `bson:"executionTimeMillisEstimate"` + Advanced int `bson:"advanced" json:"advanced"` + Direction string `bson:"direction" json:"direction"` + DocsExamined int `bson:"docsExamined" json:"docsExamined"` + ExecutionTimeMillisEstimate int `bson:"executionTimeMillisEstimate" json:"executionTimeMillisEstimate"` Filter struct { Date struct { - Eq string `bson:"$eq"` - } `bson:"date"` - } `bson:"filter"` - Invalidates int `bson:"invalidates"` - IsEOF int `bson:"isEOF"` - NReturned int `bson:"nReturned"` - NeedTime int `bson:"needTime"` - NeedYield int `bson:"needYield"` - RestoreState int `bson:"restoreState"` - SaveState int `bson:"saveState"` - Stage string `bson:"stage"` - Works int `bson:"works"` - } `bson:"inputStage"` - Invalidates int `bson:"invalidates"` - IsEOF int `bson:"isEOF"` - LimitAmount int `bson:"limitAmount"` - NReturned int `bson:"nReturned"` - NeedTime int `bson:"needTime"` - NeedYield int `bson:"needYield"` - RestoreState int `bson:"restoreState"` - SaveState int `bson:"saveState"` - Stage string `bson:"stage"` - Works int `bson:"works"` - DocsExamined int `bson:"docsExamined"` - } `bson:"execStats"` - KeyUpdates int `bson:"keyUpdates"` - KeysExamined int `bson:"keysExamined"` + Eq string `bson:"$eq" json:"$eq"` + } `bson:"date" json:"date"` + } `bson:"filter" json:"filter"` + Invalidates int `bson:"invalidates" json:"invalidates"` + IsEOF int `bson:"isEOF" json:"isEOF"` + NReturned int `bson:"nReturned" json:"nReturned"` + NeedTime int `bson:"needTime" json:"needTime"` + NeedYield int `bson:"needYield" json:"needYield"` + RestoreState int `bson:"restoreState" json:"restoreState"` + SaveState int `bson:"saveState" json:"saveState"` + Stage string `bson:"stage" json:"stage"` + Works int `bson:"works" json:"works"` + } `bson:"inputStage" json:"inputStage"` + Invalidates int `bson:"invalidates" json:"invalidates"` + IsEOF int `bson:"isEOF" json:"isEOF"` + LimitAmount int `bson:"limitAmount" json:"limitAmount"` + NReturned int `bson:"nReturned" json:"nReturned"` + NeedTime int `bson:"needTime" json:"needTime"` + NeedYield int `bson:"needYield" json:"needYield"` + RestoreState int `bson:"restoreState" json:"restoreState"` + SaveState int `bson:"saveState" json:"saveState"` + Stage string `bson:"stage" json:"stage"` + Works int `bson:"works" json:"works"` + DocsExamined int `bson:"docsExamined" json:"docsExamined"` + } `bson:"execStats" json:"execStats"` + KeyUpdates int `bson:"keyUpdates" json:"keyUpdates"` + KeysExamined int `bson:"keysExamined" json:"keysExamined"` Locks struct { Collection struct { AcquireCount struct { - Read int `bson:"R"` - ReadShared int `bson:"r"` - } `bson:"acquireCount"` - } `bson:"Collection"` + Read int `bson:"R" json:"R"` + ReadShared int `bson:"r" json:"r"` + } `bson:"acquireCount" json:"acquireCount"` + } `bson:"Collection" json:"Collection"` Database struct { AcquireCount struct { - ReadShared int `bson:"r"` - } `bson:"acquireCount"` + ReadShared int `bson:"r" json:"r"` + } `bson:"acquireCount" json:"acquireCount"` AcquireWaitCount struct { - ReadShared int `bson:"r"` - } `bson:"acquireWaitCount"` + ReadShared int `bson:"r" json:"r"` + } `bson:"acquireWaitCount" json:"acquireWaitCount"` TimeAcquiringMicros struct { - ReadShared int64 `bson:"r"` - } `bson:"timeAcquiringMicros"` - } `bson:"Database"` + ReadShared int64 `bson:"r" json:"r"` + } `bson:"timeAcquiringMicros" json:"timeAcquiringMicros"` + } `bson:"Database" json:"Database"` Global struct { AcquireCount struct { - ReadShared int `bson:"r"` - WriteShared int `bson:"w"` - } `bson:"acquireCount"` - } `bson:"Global"` + ReadShared int `bson:"r" json:"r"` + WriteShared int `bson:"w" json:"w"` + } `bson:"acquireCount" json:"acquireCount"` + } `bson:"Global" json:"Global"` MMAPV1Journal struct { AcquireCount struct { - ReadShared int `bson:"r"` - } `bson:"acquireCount"` - } `bson:"MMAPV1Journal"` - } `bson:"locks"` - Millis int `bson:"millis"` - Nreturned int `bson:"nreturned"` - Ns string `bson:"ns"` - NumYield int `bson:"numYield"` - Op string `bson:"op"` - PlanSummary string `bson:"planSummary"` - Protocol string `bson:"protocol"` - Query bson.D `bson:"query"` - UpdateObj bson.D `bson:"updateobj"` - Command bson.D `bson:"command"` - OriginatingCommand bson.D `bson:"originatingCommand"` - ResponseLength int `bson:"responseLength"` - Ts time.Time `bson:"ts"` - User string `bson:"user"` - WriteConflicts int `bson:"writeConflicts"` - DocsExamined int `bson:"docsExamined"` - QueryHash string `bson:"queryHash"` + ReadShared int `bson:"r" json:"r"` + } `bson:"acquireCount" json:"acquireCount"` + } `bson:"MMAPV1Journal" json:"MMAPV1Journal"` + } `bson:"locks" json:"locks"` + Millis int `bson:"millis" json:"durationMillis"` + Nreturned int `bson:"nreturned" json:"nreturned"` + Ns string `bson:"ns" json:"ns"` + NumYield int `bson:"numYield" json:"numYield"` + Op string `bson:"op" json:"op"` + PlanSummary string `bson:"planSummary" json:"planSummary"` + Protocol string `bson:"protocol" json:"protocol"` + Query bson.D `bson:"query" json:"query"` + UpdateObj bson.D `bson:"updateobj" json:"updateobj"` + Command bson.D `bson:"command" json:"command"` + OriginatingCommand bson.D `bson:"originatingCommand" json:"originatingCommand"` + ResponseLength int `bson:"responseLength" json:"reslen"` + Ts time.Time `bson:"ts" json:"ts"` + User string `bson:"user" json:"user"` + WriteConflicts int `bson:"writeConflicts" json:"writeConflicts"` + DocsExamined int `bson:"docsExamined" json:"docsExamined"` + QueryHash string `bson:"queryHash" json:"queryHash"` Storage struct { Data struct { - BytesRead int64 `bson:"bytesRead"` - TimeReadingMicros int64 `bson:"timeReadingMicros"` - } `bson:"data"` - } `bson:"storage"` - AppName string `bson:"appName"` - Comments string `bson:"comments"` + BytesRead int64 `bson:"bytesRead" json:"bytesRead"` + TimeReadingMicros int64 `bson:"timeReadingMicros" json:"timeReadingMicros"` + } `bson:"data" json:"data"` + } `bson:"storage" json:"storage"` + AppName string `bson:"appName" json:"appName"` + Comments string `bson:"comments" json:"comments"` } func NewExampleQuery(doc SystemProfile) ExampleQuery {