use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class ScannerPluginInstaller method loadPluginIndex.
private String loadPluginIndex() {
Profiler profiler = Profiler.create(LOG).startInfo("Load plugins index");
GetRequest getRequest = new GetRequest(PLUGINS_INDEX_URL);
String str;
try (Reader reader = wsClient.call(getRequest).contentReader()) {
str = IOUtils.toString(reader);
} catch (IOException e) {
throw new IllegalStateException(e);
}
profiler.stopInfo();
return str;
}
use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class InitializersExecutor method execute.
public void execute() {
Collection<Initializer> initializers = selector.select(Initializer.class, module, true, null);
eventBus.fireEvent(new InitializersPhaseEvent(Lists.newArrayList(initializers), true));
if (LOG.isDebugEnabled()) {
LOG.debug("Initializers : {}", StringUtils.join(initializers, " -> "));
}
Project project = new Project(module.definition());
for (Initializer initializer : initializers) {
eventBus.fireEvent(new InitializerExecutionEvent(initializer, true));
Profiler profiler = Profiler.create(LOG).startInfo("Initializer " + initializer);
initializer.execute(project);
profiler.stopInfo();
eventBus.fireEvent(new InitializerExecutionEvent(initializer, false));
}
eventBus.fireEvent(new InitializersPhaseEvent(Lists.newArrayList(initializers), false));
}
use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class ProjectRepositoriesProvider method provide.
public ProjectRepositories provide(ProjectRepositoriesLoader loader, ProjectKey projectKey, DefaultAnalysisMode mode) {
if (project == null) {
Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
project = loader.load(projectKey.get(), mode.isIssues());
checkProject(mode);
profiler.stopInfo();
}
return project;
}
use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class QualityProfileProvider method provide.
public ModuleQProfiles provide(ProjectKey projectKey, QualityProfileLoader loader, ProjectRepositories projectRepositories, AnalysisProperties props) {
if (this.profiles == null) {
List<QualityProfile> profileList;
Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
if (!projectRepositories.exists()) {
profileList = loader.loadDefault(getSonarProfile(props));
} else {
profileList = loader.load(projectKey.get(), getSonarProfile(props));
}
profiler.stopInfo();
profiles = new ModuleQProfiles(profileList);
}
return profiles;
}
use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class DefaultSettingsLoader method load.
@Override
public Map<String, String> load(@Nullable String componentKey) {
String url = "api/settings/values.protobuf";
Profiler profiler = Profiler.create(LOG);
if (componentKey != null) {
url += "?component=" + ScannerUtils.encodeForUrl(componentKey);
profiler.startInfo("Load settings for component '" + componentKey + "'");
} else {
profiler.startInfo("Load global settings");
}
try (InputStream is = wsClient.call(new GetRequest(url)).contentStream()) {
ValuesWsResponse values = ValuesWsResponse.parseFrom(is);
profiler.stopInfo();
return toMap(values.getSettingsList());
} catch (IOException e) {
throw new IllegalStateException("Failed to load server settings", e);
}
}
Aggregations