Package org.sonar.core.profiling

Examples of org.sonar.core.profiling.StopWatch


  }

  @Override
  public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    if (method.getName().startsWith("execute")) {
      StopWatch watch = PROFILING.start();
      Object result = null;
      try {
        result = InvocationUtils.invokeQuietly(statement, method, args);
      } finally {
        PROFILING.stop(watch, (String) args[0]);
View Full Code Here


  }

  @Override
  public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    if (method.getName().startsWith("execute")) {
      StopWatch watch = PROFILING.start();
      Object result = null;
      try {
        result = InvocationUtils.invokeQuietly(statement, method, args);
      } finally {
        StringBuilder sqlBuilder = new StringBuilder().append(sql);
View Full Code Here

    this.profiling = profiling;
  }

  @Override
  public NodesStatsResponse get() {
    StopWatch fullProfile = profiling.start("nodes stats", Profiling.Level.FULL);
    try {
      return super.execute().actionGet();
    } catch (Exception e) {
      throw new IllegalStateException(String.format("Fail to execute %s", toString()), e);
    } finally {
      if (profiling.isProfilingEnabled(Profiling.Level.BASIC)) {
        fullProfile.stop("%s", toString());
      }
    }
  }
View Full Code Here

    this.factory = factory;
    this.profiling = profiling;
  }

  public MeasureFilterResult execute(Map<String, Object> filterMap, @Nullable Long userId) {
    StopWatch watch = profiling.start("measures", Level.BASIC);
    StopWatch sqlWatch = null;
    MeasureFilterResult result = new MeasureFilterResult();
    MeasureFilterContext context = new MeasureFilterContext();
    context.setUserId(userId);
    context.setData(String.format("{%s}", Joiner.on('|').withKeyValueSeparator("=").join(filterMap)));
    try {
      MeasureFilter filter = factory.create(filterMap);
      sqlWatch = profiling.start("sql", Level.FULL);
      List<MeasureFilterRow> rows = executor.execute(filter, context);
      result.setRows(rows);

    } catch (NumberFormatException e) {
      result.setError(MeasureFilterResult.Error.VALUE_SHOULD_BE_A_NUMBER);
      LOG.debug("Value selected for the metric should be a number: " + context);
    } catch (Exception e) {
      result.setError(MeasureFilterResult.Error.UNKNOWN);
      LOG.error("Fail to execute measure filter: " + context, e);
    } finally {
      if (sqlWatch != null) {
        sqlWatch.stop(context.getSql());
      }
      watch.stop(log(context, result));
    }
    return result;
  }
View Full Code Here

    this.profiling = profiling;
  }

  @Override
  public DeleteByQueryResponse get() {
    StopWatch fullProfile = profiling.start("delete by query", Profiling.Level.FULL);
    try {
      return super.execute().actionGet();
    } catch (Exception e) {
      throw new IllegalStateException(String.format("Fail to execute %s", toString()), e);
    } finally {
      if (profiling.isProfilingEnabled(Profiling.Level.BASIC)) {
        fullProfile.stop("%s", toString());
      }
    }
  }
View Full Code Here

    this.profiling = profiling;
  }

  @Override
  public FlushResponse get() {
    StopWatch fullProfile = profiling.start("flush", Profiling.Level.FULL);
    try {
      return super.execute().actionGet();
    } catch (Exception e) {
      throw new IllegalStateException(String.format("Fail to execute %s", toString()), e);
    } finally {
      if (profiling.isProfilingEnabled(Profiling.Level.BASIC)) {
        fullProfile.stop("%s", toString());
      }
    }
  }
View Full Code Here

    this.profiling = profiling;
  }

  @Override
  public ClusterStatsResponse get() {
    StopWatch fullProfile = profiling.start("cluster stats", Profiling.Level.FULL);
    try {
      return super.execute().actionGet();
    } catch (Exception e) {
      throw new IllegalStateException(String.format("Fail to execute %s", toString()), e);
    } finally {
      if (profiling.isProfilingEnabled(Profiling.Level.BASIC)) {
        fullProfile.stop("%s", toString());
      }
    }
  }
View Full Code Here

    this.profiling = profiling;
  }

  @Override
  public SearchResponse get() {
    StopWatch fullProfile = profiling.start("search", Profiling.Level.FULL);
    try {
      return super.execute().actionGet();
    } catch (Exception e) {
      throw new IllegalStateException(String.format("Fail to execute %s", toString()), e);
    } finally {
      if (profiling.isProfilingEnabled(Profiling.Level.BASIC)) {
        fullProfile.stop("%s", toString());
      }
    }
  }
View Full Code Here

    this.profiling = profiling;
  }

  @Override
  public PutMappingResponse get() {
    StopWatch fullProfile = profiling.start("put mapping", Profiling.Level.FULL);
    try {
      return super.execute().actionGet();
    } catch (Exception e) {
      throw new IllegalStateException(String.format("Fail to execute %s", toString()), e);
    } finally {
      if (profiling.isProfilingEnabled(Profiling.Level.BASIC)) {
        fullProfile.stop("%s", toString());
      }
    }
  }
View Full Code Here

    this.profiling = profiling;
  }

  @Override
  public ClusterHealthResponse get() {
    StopWatch fullProfile = profiling.start("cluster health", Profiling.Level.FULL);
    try {
      return super.execute().actionGet();
    } catch (Exception e) {
      throw new IllegalStateException(String.format("Fail to execute %s", toString()), e);
    } finally {
      if (profiling.isProfilingEnabled(Profiling.Level.BASIC)) {
        fullProfile.stop("%s", toString());
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.sonar.core.profiling.StopWatch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.