Separate out GitHub tracking log from Gitlab::Import::Metrics
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
The following discussion from !113724 (merged) should be addressed:
-
@mkaeppler
started a discussion:This is not really what I had in mind; you are still mixing GitHub implementation details with a generic class that is used for imports with a different source
🤔 I see this was already the case with
track_usage_event
before this change; let's create a follow-up to unblock this MR, but I suggest you discuss this with groupimport since this is a design smell, given thatGitlab::Import::Metrics
is used in all kinds of places unrelated to GitHub imports.
It appears we have an implementation leak in this class; it is used for many kinds of imports (e.g. BitBucket) yet contains GitHub-specific tracking logic. Because of this leak, it uses defensive code such as early returns in cases where the source is not GitHub. A better approach would be to inject a specific tracking implementation into this class so that we can always delegate to it. In cases where we do not want to emit any events, we can use a null implementation.