use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class ComponentContainer method createPicoContainer.
public static MutablePicoContainer createPicoContainer() {
ReflectionLifecycleStrategy lifecycleStrategy = new ReflectionLifecycleStrategy(new NullComponentMonitor(), "start", "stop", "close") {
@Override
public void start(Object component) {
Profiler profiler = Profiler.createIfTrace(Loggers.get(ComponentContainer.class));
profiler.start();
super.start(component);
profiler.stopTrace(component.getClass().getCanonicalName() + " started");
}
};
return new ExtendedDefaultPicoContainer(new OptInCaching(), lifecycleStrategy, null);
}
use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class ScannerWsClient method call.
/**
* If an exception is not thrown, the response needs to be closed by either calling close() directly, or closing the
* body content's stream/reader.
* @throws IllegalStateException if the request could not be executed due to
* a connectivity problem or timeout. Because networks can
* fail during an exchange, it is possible that the remote server
* accepted the request before the failure
* @throws HttpException if the response code is not in range [200..300)
*/
public WsResponse call(WsRequest request) {
Preconditions.checkState(!globalMode.isMediumTest(), "No WS call should be made in medium test mode");
Profiler profiler = Profiler.createIfDebug(LOG).start();
WsResponse response = target.wsConnector().call(request);
profiler.stopDebug(format("%s %d %s", request.getMethod(), response.code(), response.requestUrl()));
failIfUnauthorized(response);
return response;
}
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 MetricsRepositoryProvider method provide.
public MetricsRepository provide(MetricsRepositoryLoader loader) {
if (metricsRepository == null) {
Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
metricsRepository = loader.load();
profiler.stopInfo();
}
return metricsRepository;
}
Aggregations