Add mem_total_bytes metric to Memory instrumentation
What does this MR do?
This tracks the total amount of bytes allocated during a web transaction by taking into account both malloc'ed objects as well as heap slots occupied by newly allocated objects.
This is useful to get an idea of how much memory can be allotted to a given request overall, even when no extra malloc
s were required. We will use this in the new memory gauge in the Performance Bar in !61332 (merged)
Not user-facing since this will merely appear in logs for now.
Screenshots (strongly suggested)
Grabbing a log line emitted via log/development_json.log
:
{
"method": "GET",
"path": "/",
"format": "html",
"controller": "RootController",
"action": "index",
"status": 200,
"time": "2021-05-14T13:44:40.707Z",
"params": [],
"remote_ip": "172.17.0.1",
"user_id": 1,
"username": "root",
"ua": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0",
"correlation_id": "01F5NHY08WH39C8QT35VXBMW60",
"meta.user": "root",
"meta.caller_id": "RootController#index",
"meta.remote_ip": "172.17.0.1",
"meta.feature_category": "projects",
"meta.client_id": "user/1",
"gitaly_calls": 4,
"gitaly_duration_s": 0.088498,
"db_count": 74,
"db_write_count": 3,
"db_cached_count": 11,
"cpu_s": 13.977864,
"mem_objects": 6403300,
"mem_bytes": 492366475,
"mem_mallocs": 1732162,
"mem_total_bytes": 748498475,
"queue_duration_s": 0.84261,
"db_duration_s": 0.44699,
"view_duration_s": 5.78625,
"duration_s": 7.45504
}
Sanity check:
[15:47:08] work/gl-gck::master ✔ echo '6403300 * 40 + 492366475' | bc
748498475
Does this MR meet the acceptance criteria?
Conformity
-
I have included a changelog entry, or it's not needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed. -
I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
Edited by Matthias Käppler