Skip to content

Keep diag report file in tmp subdir until we finish streaming into it

What does this MR do and why?

We want to separate reports that are still streaming and not finished from ones that are ready.
We will keep them in the dedicated /tmp subdir under the reports dir.
When the report is ready and we no longer write to the file, we will mv it to the permanent location.

This is especially important for reports uploader to avoid workarounds such as !97155 (comment 1094955331)

How to set up and validate locally

Set ENV vars to enable Jemalloc reports.
We do not produce Jemalloc reports on OSX, because to pull the actual Jemalloc report, libjemalloc must be on LD_PRELOAD (more).

Fortunately, it is already configured in GCK this way. So it is recommended to use GCK if you want to test it manually.

First, you need to set ENV vars to enable Jemalloc reports:

export GITLAB_DIAGNOSTIC_REPORTS_ENABLED='true'
export GITLAB_DIAGNOSTIC_REPORTS_SLEEP_S='5'
export GITLAB_DIAGNOSTIC_REPORTS_SLEEP_BETWEEN_REPORTS_S='1'
export GITLAB_DIAGNOSTIC_REPORTS_SLEEP_MAX_DELTA_S='0'
export GITLAB_DIAGNOSTIC_REPORTS_PATH='/home/git/gitlab/tmp/diag-reports'

Second, you need to enable FF: Feature.enable(:report_jemalloc_stats)

The reports should be produced as usual, you should also notice that the /tmp subdir under the configured GITLAB_DIAGNOSTIC_REPORTS_PATH should appear.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #372850 (closed)

Edited by Aleksei Lipniagov

Merge request reports