Add extended metrics and labels for MongoDB QAN

Description

 

Here’s a sample document. I’ve highlighted the fields I think it’s worth having:

{

"op" : "query",

"ns" : "test.report",

"command" : {

"find" : "report",

"filter" : { "a" : { "$lte" : 500 } },

"lsid" : {

"id" : UUID("5ccd5b81-b023-41f3-8959-bf99ed696ce9")

},

"$db" : "test"

},

"cursorid" : 33629063128,

"keysExamined" : 101,

"docsExamined" : 101,

"fromMultiPlanner" : true,

"numYield" : 2,

"nreturned" : 101,

"queryHash" : "811451DD",

"planCacheKey" : "759981BA",

"queryFramework" : "classic",

"locks" : {

"Global" : {

"acquireCount" : {

"r" : NumberLong(3),

"w" : NumberLong(3)

}

},

"Database" : {

"acquireCount" : { "r" : NumberLong(3) },

"acquireWaitCount" : { "r" : NumberLong(1) },

"timeAcquiringMicros" : { "r" : NumberLong(69130694) }

},

"Collection" : {

"acquireCount" : { "r" : NumberLong(3) }

}

},

"storage" : {

"data" : {

"bytesRead" : NumberLong(14736),

"timeReadingMicros" : NumberLong(17)

}

},

"responseLength" : 1305014,

"protocol" : "op_msg",

"millis" : 69132,

"planningTimeMicros" : 129,

"planSummary" : "IXSCAN { a: 1, _id: -1 }",

"execStats" : {

"stage" : "FETCH",

"nReturned" : 101,

"executionTimeMillisEstimate" : 0,

"works" : 101,

"advanced" : 101,

"needTime" : 0,

"needYield" : 0,

"saveState" : 3,

"restoreState" : 2,

"isEOF" : 0,

"docsExamined" : 101,

"alreadyHasObj" : 0,

"inputStage" : {

...

}

},

"ts" : ISODate("2019-01-14T16:57:33.450Z"),

"client" : "127.0.0.1",

"appName" : "MongoDB Shell",

"allUsers" : [

{

"user" : "someuser",

"db" : "admin"

}

],

"user" : "someuser@admin"

}

 

 

it would be interesting to have those addressed in the QAN in order to facilitate offensive hosts, users, or Apps.

UI

  • same as PGSM related metrics

Refinement notes:

  • Percona toolkit backend code can be ported

  • Frontend - new metrics and new static filters / labels to be added

In scope metrics:

  • metric values (query time, docs examined, docs returned, locks acquire count and wait, storage bytes read, time reading micros )

  • metadata values (client, appName, user, db)

Out of scope for this ticket:

  • metadata values (comments)

  • data required for additional features(example, explain)

How to test

  1. Prepare PMM and add Mongo to monitoring.

  2. Enabled profiler in Mongo.

  3. Run different kind of queries. INSERT, ADD, DELETE, SEARCH etc.

  4. Go to QAN select one of queries mentioned above and check details for new rows:

  5. Also check filter of QAN, there should be new groups available called “Application Name”, “Client Host” and “User name”. You should be able to filter by those values.Application NameApplication Name

How to document

None

is cloned by

Activity

Show:

Catalina Adam 
March 10, 2025 at 11:38 AM

Documented with

Jiří Čtvrtka 
February 18, 2025 at 11:55 AM

What should be correct presentation for “responseLength”? I am show for example “min”, “max” and “avg”?

Roma Novikov 
December 9, 2024 at 12:43 PM
(edited)

This is getting too big, so I’ve split the issue and keep here the Plan tracking and new metrics/labels will go to

Nurlan Moldomurov 
October 24, 2024 at 5:06 PM
(edited)

saving the complete document makes no sense, we need to classify them by usage type to show data to user in useful manner:
* key values (ts, queryHash, fingerprint with all required info)
* metric values (query time, docs returned, etc with numbers)
* metadata values (client, appName, user, comments)
* data required for additional features(example, explain)
* everything else

Nurlan Moldomurov 
October 24, 2024 at 1:24 PM

I think we need to check the whole profiler output and decide which metrics will be useful to provide in QAN. Can you please review this link and provide your thoughts what should be collected so we can discuss it on monday meeting.

Done

Details

Assignee

Reporter

Priority

Needs QA

Needs Doc

Planned Version/s

Fix versions

Story Points

Sprint

Smart Checklist Progress

Start date

Due date

Created December 8, 2021 at 6:24 PM
Updated March 31, 2025 at 12:08 PM
Resolved March 13, 2025 at 10:16 AM