Log large JSON objects
What does this MR do and why?
Update Gitlab::HTTP and Gitlab::Json.parse to log JSON objects that have many objects
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
-
Start Rails console with
GITLAB_JSON_SIZE_THRESHOLDenvironment variable setGITLAB_JSON_SIZE_THRESHOLD=5 bin/rails c -
Parse a large JSON string
Gitlab::Json.parse('{"key1": "value1", "key2": ["item1", "item2"], "key3": {"nested": "value"}}') -
Check if you see an entry in
log/application_json.log -
Make a request using Gitlab::HTTP to an endpoint that returns a JSON response
Gitlab::HTTP.get('https://gitlab.com/api/v4/projects').parsed_response -
Repeat steps 1-4 using different GITLAB_JSON_SIZE_THRESHOLD values.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.