use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class RegisterPermissionTemplates method start.
@Override
public void start() {
Profiler profiler = Profiler.create(Loggers.get(getClass())).startInfo("Register permission templates");
try (DbSession dbSession = dbClient.openSession(false)) {
Optional<String> defaultProjectTemplate = dbClient.internalPropertiesDao().selectByKey(dbSession, DEFAULT_PROJECT_TEMPLATE);
if (!defaultProjectTemplate.isPresent()) {
PermissionTemplateDto defaultTemplate = getOrInsertDefaultTemplate(dbSession);
dbClient.internalPropertiesDao().save(dbSession, DEFAULT_PROJECT_TEMPLATE, defaultTemplate.getUuid());
dbSession.commit();
}
}
profiler.stopDebug();
}
use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class MetricsRepositoryProvider method provide.
@Bean("MetricsRepository")
public MetricsRepository provide(MetricsRepositoryLoader loader) {
Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
MetricsRepository metricsRepository = loader.load();
profiler.stopInfo();
return metricsRepository;
}
use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class ReferenceBranchSupplier method get.
@CheckForNull
public String get() {
// branches will be empty in CE
if (branchConfiguration.isPullRequest() || branches.isEmpty()) {
return null;
}
Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG_WS);
String branchName = branchConfiguration.branchName() != null ? branchConfiguration.branchName() : branches.defaultBranchName();
NewCodePeriods.ShowWSResponse newCode = newCodePeriodLoader.load(project.key(), branchName);
profiler.stopInfo();
if (newCode.getType() != NewCodePeriods.NewCodePeriodType.REFERENCE_BRANCH) {
return null;
}
String referenceBranchName = newCode.getValue();
if (branchName.equals(referenceBranchName)) {
LOG.warn("New Code reference branch is set to the branch being analyzed. Skipping the computation of New Code");
return null;
}
return referenceBranchName;
}
use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class ProjectRepositoriesSupplier method get.
public ProjectRepositories get() {
if (project == null) {
Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
project = loader.load(scannerProperties.getProjectKey(), branchConfig.referenceBranchName());
profiler.stopInfo();
}
return project;
}
use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class QualityProfilesProvider method provide.
@Bean("QualityProfiles")
public QualityProfiles provide(QualityProfileLoader loader, ScannerProperties props) {
Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
QualityProfiles profiles = new QualityProfiles(loader.load(props.getProjectKey()));
profiler.stopInfo();
return profiles;
}
Aggregations