Skip to content

PMM-12548 Add json tags for PMM purposes. #951

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

Draft
wants to merge 2 commits into
base: 3.x
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 79 additions & 78 deletions src/go/mongolib/proto/system.profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading