refactor: only collect package name if a global variable is set for speed reason

Merge request reports