Search in sources :

Example 1 with Profiler

use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.

the class DefaultServerLineHashesLoader method loadHashesFromWs.

private String loadHashesFromWs(String fileKey) {
    Profiler profiler = Profiler.createIfDebug(Loggers.get(getClass())).addContext("file", fileKey).startDebug("Load line hashes");
    GetRequest getRequest = new GetRequest("/api/sources/hash?key=" + ScannerUtils.encodeForUrl(fileKey));
    Reader reader = wsClient.call(getRequest).contentReader();
    try {
        return IOUtils.toString(reader);
    } catch (IOException e) {
        throw new IllegalStateException(e);
    } finally {
        profiler.stopDebug();
    }
}
Also used : Profiler(org.sonar.api.utils.log.Profiler) GetRequest(org.sonarqube.ws.client.GetRequest) Reader(java.io.Reader) IOException(java.io.IOException)

Example 2 with Profiler

use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.

the class ServerIssueRepository method load.

public void load() {
    Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
    this.issuesCache = caches.createCache("previousIssues");
    caches.registerValueCoder(ServerIssue.class, new ServerIssueValueCoder());
    previousIssuesLoader.load(reactor.getRoot().getKeyWithBranch(), new SaveIssueConsumer());
    profiler.stopInfo();
}
Also used : Profiler(org.sonar.api.utils.log.Profiler)

Example 3 with Profiler

use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.

the class ScannerPluginInstaller method loadPlugins.

private Map<String, PluginInfo> loadPlugins(List<RemotePlugin> remotePlugins) {
    Map<String, PluginInfo> infosByKey = new HashMap<>(remotePlugins.size());
    Profiler profiler = Profiler.create(LOG).startDebug("Load plugins");
    for (RemotePlugin remotePlugin : remotePlugins) {
        if (pluginPredicate.apply(remotePlugin.getKey())) {
            File jarFile = download(remotePlugin);
            PluginInfo info = PluginInfo.create(jarFile);
            infosByKey.put(info.getKey(), info);
        }
    }
    profiler.stopDebug();
    return infosByKey;
}
Also used : Profiler(org.sonar.api.utils.log.Profiler) HashMap(java.util.HashMap) RemotePlugin(org.sonar.core.platform.RemotePlugin) PluginInfo(org.sonar.core.platform.PluginInfo) RemotePluginFile(org.sonar.core.platform.RemotePluginFile) File(java.io.File)

Example 4 with Profiler

use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.

the class RulesProvider method load.

private static Rules load(RulesLoader ref) {
    Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
    List<Rule> loadedRules = ref.load();
    RulesBuilder builder = new RulesBuilder();
    for (Rule r : loadedRules) {
        NewRule newRule = builder.add(RuleKey.of(r.getRepository(), r.getKey()));
        newRule.setName(r.getName());
        newRule.setInternalKey(r.getInternalKey());
    }
    profiler.stopInfo();
    return builder.build();
}
Also used : Profiler(org.sonar.api.utils.log.Profiler) NewRule(org.sonar.api.batch.rule.internal.NewRule) Rule(org.sonarqube.ws.Rules.ListResponse.Rule) RulesBuilder(org.sonar.api.batch.rule.internal.RulesBuilder) NewRule(org.sonar.api.batch.rule.internal.NewRule)

Example 5 with Profiler

use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.

the class PrivilegedPluginsBootstraper method onServerStart.

@Override
public void onServerStart(Server server) {
    List<PrivilegedPluginBridge> bridges = componentContainer.getComponentsByType(PrivilegedPluginBridge.class);
    for (PrivilegedPluginBridge bridge : bridges) {
        Profiler profiler = Profiler.create(LOGGER).startInfo(format("Bootstrapping %s", bridge.getPluginName()));
        bridge.startPlugin(componentContainer);
        profiler.stopInfo();
    }
}
Also used : PrivilegedPluginBridge(org.sonar.plugin.PrivilegedPluginBridge) Profiler(org.sonar.api.utils.log.Profiler)

Aggregations

Profiler (org.sonar.api.utils.log.Profiler)56 Bean (org.springframework.context.annotation.Bean)7 HashMap (java.util.HashMap)6 IOException (java.io.IOException)5 DbSession (org.sonar.db.DbSession)5 GetRequest (org.sonarqube.ws.client.GetRequest)5 File (java.io.File)3 Reader (java.io.Reader)3 RulesDefinition (org.sonar.api.server.rule.RulesDefinition)3 InputStream (java.io.InputStream)2 Path (java.nio.file.Path)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 CheckForNull (javax.annotation.CheckForNull)2 OptInCaching (org.picocontainer.behaviors.OptInCaching)2 ReflectionLifecycleStrategy (org.picocontainer.lifecycle.ReflectionLifecycleStrategy)2 NullComponentMonitor (org.picocontainer.monitors.NullComponentMonitor)2 InputFile (org.sonar.api.batch.fs.InputFile)2 NewRule (org.sonar.api.batch.rule.internal.NewRule)2 RulesBuilder (org.sonar.api.batch.rule.internal.RulesBuilder)2