Update installation_creation_date metric to be more robust
Problem
In https://gitlab.com/gitlab-data/analytics/-/issues/16132 it was discovered that the current method to compute installation_creation_date
is not as robust as we'd like. It is currently based on the created_at
of the user with id 1 (e.g. root user). However, it was discovered that this user can be deleted, which would lead to this metric being empty.
In addition we discovered that it already happened once that we got a malformed date (see https://gitlab.com/gitlab-data/analytics/-/issues/16353#note_1368771075).
Proposed solution
Since it's hard to trust that a single model has not been deleted out of some reason we want to depend on multiple models and choose the earliest one as an approximate creation_date
. Based on feedback from @tkuah
application_settings
should be another model that is created at time of creation of the instance and not deleted. The suggested approach to compute the installation_creation_date
in pseudocode:
[User.first, ApplicationSettings.first].map(:created_at).min
This should be created as a new metric, while we keep the old one around. The original installation_creation_date
can then be removed at a a later point through https://gitlab.com/gitlab-data/analytics/-/issues/16474
As per #403612 (comment 1356919312) we should create a new metric and remove the old one.