Skip to content

Troubleshooting

Migrating from deprecated classes and selectors

Section titled “Migrating from deprecated classes and selectors”

Older scripts, including some blog posts, use names that are now deprecated or removed. Use the current name instead.

Old nameStatusUse instead
GLHModelImporterdeprecatedGitlabModelImporter
GLPHModelImporterdeprecatedGitlabModelImporter
GitlabWithMergeRequestModelImporterdeprecatedGitlabModelImporter
GHModelImporterdeprecatedGithubModelImporter
GHApideprecatedGithubApi (created by GithubModelImporter)
GLPHApiremovedGitlabApi
GLPHEMergeRequestremovedGLHMergeRequest
baseAPIUrl: (GitLab API)removedhostUrl:
makeGlobal: (importer)removed— (store the importer in a variable)
importMergeRequests:removedimportMergeRequestsOfProject:
importMergeRequests:since:until:removedimportMergeRequestsOfProject:since:until:
toScope:deprecated (Moose)containedEntitiesOfType:
allToScope:deprecated (Moose)allContainedEntitiesOfType:
allProjectstoScopeuses toScope:containedEntitiesOfType: GLHProject
GitMetricExporter>>exportFor:, exportFor:over:deprecatedgenerateAnalysesOver: then exportInCSV
GitMetricExporter>>addEntitiesFromUserNames:deprecatedsetupAnalysisForUsersWithNames:

API imports send one or more HTTP requests per entity. To speed them up:

  • reduce the period: withCommitsSince: 7 days;
  • disable what you do not need: withCommitDiffs: false, withFiles: false;
  • import merge requests for a period (importMergeRequestsOfProject:since:until:) rather than all of them;
  • use the local importer for the history, or the mixed importer if you also need merge requests.

The GitHub REST API allows 5,000 requests per hour with a token (60 without). Large organizations can exceed this limit: import fewer repositories at once, reduce the period, or wait for the limit to reset.

Local GLHRepository without importer reference

Section titled “Local GLHRepository without importer reference”

The local importer cannot find the clone. Set the path on the repository before importing:

repository cacheAt: #localImporterReference put: '/path/to/clone' asFileReference.

If the repository belongs to a project with a web_url, the importer tries to clone it into ./msr/<project name>: check that your Iceberg credentials give access to it.

Some branches are missing with the local importer

Section titled “Some branches are missing with the local importer”

The local importer reads local branches only. Create local tracking branches for the remote ones (see Clone the repository).

importLatestMergeRequestsOfProject: imports the 20 latest merge requests only. Use importMergeRequestsOfProject:since:until: to import a period.

Bitbucket api cannot import directly a project

Section titled “Bitbucket api cannot import directly a project”

On Bitbucket, import the Bitbucket project with importGroup: 'KEY': its repositories are imported as GLHProjects.

The GitLab host URL must point to the API, including /api/v4, for instance https://gitlab.mycompany.com/api/v4.

The local importer keeps caches on the imported entities. Clear them after the import:

model flush.
model entities do: #flush.

Avoid withDiffRanges: true and withFiles: true unless you need them.

Importers log their progress with MoreLogger (recordInfo). See its documentation to choose where the logs are written.