Search in sources :

Example 21 with Profiler

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;
}
Also used : Profiler(org.sonar.api.utils.log.Profiler)

Example 22 with Profiler

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;
}
Also used : Profiler(org.sonar.api.utils.log.Profiler) QualityProfile(org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile) ModuleQProfiles(org.sonar.scanner.rule.ModuleQProfiles)

Example 23 with Profiler

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);
    }
}
Also used : ValuesWsResponse(org.sonarqube.ws.Settings.ValuesWsResponse) Profiler(org.sonar.api.utils.log.Profiler) InputStream(java.io.InputStream) GetRequest(org.sonarqube.ws.client.GetRequest) IOException(java.io.IOException)

Example 24 with Profiler

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

the class ActiveRulesProvider method provide.

public ActiveRules provide(ActiveRulesLoader loader, ModuleQProfiles qProfiles) {
    if (singleton == null) {
        Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
        singleton = load(loader, qProfiles);
        profiler.stopInfo();
    }
    return singleton;
}
Also used : Profiler(org.sonar.api.utils.log.Profiler)

Aggregations

Profiler (org.sonar.api.utils.log.Profiler)24 DbSession (org.sonar.db.DbSession)4 IOException (java.io.IOException)3 GetRequest (org.sonarqube.ws.client.GetRequest)3 Reader (java.io.Reader)2 HashMap (java.util.HashMap)2 PrivilegedPluginBridge (org.sonar.plugin.PrivilegedPluginBridge)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 File (java.io.File)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 OptInCaching (org.picocontainer.behaviors.OptInCaching)1 ReflectionLifecycleStrategy (org.picocontainer.lifecycle.ReflectionLifecycleStrategy)1 NullComponentMonitor (org.picocontainer.monitors.NullComponentMonitor)1 Initializer (org.sonar.api.batch.Initializer)1 ProjectBuilder (org.sonar.api.batch.bootstrap.ProjectBuilder)1 ProjectDefinition (org.sonar.api.batch.bootstrap.ProjectDefinition)1 ProjectReactor (org.sonar.api.batch.bootstrap.ProjectReactor)1 ProjectBuilderContext (org.sonar.api.batch.bootstrap.internal.ProjectBuilderContext)1