Codota Logo
Profiler
Code IndexAdd Codota to your IDE (free)

How to use
Profiler
in
org.stagemonitor.tracing.profiler

Best Java code snippets using org.stagemonitor.tracing.profiler.Profiler (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
origin: stagemonitor/stagemonitor

static void method1_2() {
  Profiler.start("method1_2()");
  Profiler.addIOCall("select * from user", 50000000);
  Profiler.addIOCall("select * from address", 50000000);
  method1_2_1();
  final CallStackElement thisCallStackElement = Profiler.getMethodCallParent();
  Profiler.stop();
  thisCallStackElement.setExecutionTime(500000000);
}
static void method1_2_1() {
origin: stagemonitor/stagemonitor

static CallStackElement method0() {
  final CallStackElement callStackElement = Profiler.activateProfiling("method0()");
  try {
    method1();
    return callStackElement;
  } finally {
    final CallStackElement thisCallStackElement = Profiler.getMethodCallParent();
    Profiler.stop();
    thisCallStackElement.setExecutionTime(1000000000);
  }
}
origin: stagemonitor/stagemonitor

@Test
public void testNoProfilingIfNotActive() {
  assertFalse(Profiler.isProfilingActive());
  Profiler.start("dummy");
  assertNull(Profiler.getMethodCallParent());
  Profiler.stop();
}
origin: stagemonitor/stagemonitor

@Advice.OnMethodExit(inline = false, onThrowable = Throwable.class)
public static void onAfterEvaluate() {
  final CallStackElement currentFreemarkerCall = Profiler.getMethodCallParent();
  Profiler.stop();
  removeCurrentNodeIfItHasNoChildren(currentFreemarkerCall);
}
origin: stagemonitor/stagemonitor

  public String getFoo() {
    Profiler.start("String org.stagemonitor.tracing.freemarker.FreemarkerProfilingTransformerTest$TemplateModel.getFoo()");
    try {
      return "foo";
    } finally {
      Profiler.stop();
    }
  }
}
origin: stagemonitor/stagemonitor

  static void method1_2_1() {
    Profiler.start("method1_2_1()");
    final CallStackElement thisCallStackElement = Profiler.getMethodCallParent();
    Profiler.stop();
    thisCallStackElement.setExecutionTime(250000000);
  }
}
origin: stagemonitor/stagemonitor

@Test
public void testInnerPrivateMethod() {
  class Test {
    private void test() {
    }
  }
  Test test = new Test();
  CallStackElement total = Profiler.activateProfiling("total");
  test.test();
  Profiler.stop();
  Assert.assertFalse(total.toString(), total.getChildren().iterator().next().getSignature().contains("access$"));
}
origin: stagemonitor/stagemonitor

@Test
public void testFreemarkerProfilingMethodCall() throws Exception {
  final CallStackElement callTree = Profiler.activateProfiling("testFreemarkerProfilingMethodCall");
  final String renderedTemplate = processTemplate("test.ftl", "${templateModel.getFoo()}", new TemplateModel());
  Profiler.stop();
  Profiler.deactivateProfiling();
  assertThat(renderedTemplate).isEqualTo("foo");
  System.out.println(callTree);
  assertThat(callTree.getChildren()).hasSize(1);
  final CallStackElement freemarkerNode = callTree.getChildren().get(0);
  assertThat(freemarkerNode.getSignature()).isEqualTo("test.ftl:1#templateModel.getFoo()");
  assertThat(freemarkerNode.getChildren()).hasSize(1);
  final CallStackElement templateModelNode = freemarkerNode.getChildren().get(0);
  assertThat(templateModelNode.getSignature()).isEqualTo("String org.stagemonitor.tracing.freemarker.FreemarkerProfilingTransformerTest$TemplateModel.getFoo()");
}
origin: stagemonitor/stagemonitor

@Advice.OnMethodEnter(inline = false)
public static void addIOCall(@Advice.Argument(1) ActionRequest actionRequestBuilder) {
  if (actionRequestBuilder instanceof SearchRequest) {
    Profiler.addIOCall(ElasticsearchSearchQueryTransformer.getSearchRequestAsString((SearchRequest) actionRequestBuilder), 0L);
  }
}
origin: stagemonitor/stagemonitor

@Test
public void testProfilerActive() {
  assertFalse(Profiler.isProfilingActive());
  Profiler.activateProfiling("");
  assertTrue(Profiler.isProfilingActive());
  Profiler.deactivateProfiling();
  assertFalse(Profiler.isProfilingActive());
}
origin: stagemonitor/stagemonitor

@Override
public void onStart(SpanWrapper spanWrapper) {
  final SpanContextInformation contextInfo = SpanContextInformation.forSpan(spanWrapper);
  if (tracingPlugin.isSampled(spanWrapper) && contextInfo.getPreExecutionInterceptorContext() != null) {
    determineIfEnableProfiler(spanWrapper, contextInfo);
    if (!Profiler.isProfilingActive() && contextInfo.getPreExecutionInterceptorContext().isCollectCallTree()) {
      contextInfo.setCallTree(Profiler.activateProfiling("total"));
    }
  }
}
origin: stagemonitor/stagemonitor

@Override
public void onFinish(SpanWrapper spanWrapper, String operationName, long durationNanos) {
  final SpanContextInformation contextInfo = SpanContextInformation.forSpan(spanWrapper);
  if (contextInfo.getCallTree() != null) {
    try {
      Profiler.stop();
      if (tracingPlugin.isSampled(spanWrapper)) {
        determineIfExcludeCallTree(contextInfo);
        if (isAddCallTreeToSpan(contextInfo, operationName)) {
          addCallTreeToSpan(contextInfo, spanWrapper, operationName);
        }
      }
    } finally {
      Profiler.clearMethodCallParent();
    }
  }
}
origin: stagemonitor/stagemonitor

@Advice.OnMethodExit(onThrowable = Throwable.class)
public static void exit() {
  Profiler.stop();
}
origin: stagemonitor/stagemonitor

@Advice.OnMethodEnter
public static void enter(@ProfilerSignature String signature) {
  Profiler.start(signature);
}
origin: stagemonitor/stagemonitor

public static void addIOCall(String signature, long executionTimeNanos) {
  addCall(signature + ' ', executionTimeNanos);
}
origin: stagemonitor/stagemonitor

static void method1_1_1() {
  Profiler.start("method1_1_1()");
  final CallStackElement thisCallStackElement = Profiler.getMethodCallParent();
  Profiler.stop();
  thisCallStackElement.setExecutionTime(200000000);
}
origin: stagemonitor/stagemonitor

@Test
public void testDontProfileStagemonitorServlet() throws Exception {
  Filter filter = new HttpRequestMonitorFilter();
  final CallStackElement total = Profiler.activateProfiling("total");
  filter.doFilter(new MockHttpServletRequest(), new MockHttpServletResponse(), new MockFilterChain());
  Profiler.stop();
  assertEquals(0, total.getChildren().size());
}
origin: stagemonitor/stagemonitor

@Test
public void testFreemarkerProfiling() throws Exception {
  final CallStackElement callTree = Profiler.activateProfiling("testFreemarkerProfiling");
  final String renderedTemplate = processTemplate("test.ftl", "${templateModel.foo}", new TemplateModel());
  Profiler.stop();
  Profiler.deactivateProfiling();
  assertThat(renderedTemplate).isEqualTo("foo");
  System.out.println(callTree);
  assertThat(callTree.getChildren()).hasSize(1);
  final CallStackElement freemarkerNode = callTree.getChildren().get(0);
  assertThat(freemarkerNode.getSignature()).isEqualTo("test.ftl:1#templateModel.foo");
  assertThat(freemarkerNode.getChildren()).hasSize(1);
  final CallStackElement templateModelNode = freemarkerNode.getChildren().get(0);
  assertThat(templateModelNode.getSignature()).isEqualTo("String org.stagemonitor.tracing.freemarker.FreemarkerProfilingTransformerTest$TemplateModel.getFoo()");
}
origin: stagemonitor/stagemonitor

@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
  final Scope scope = new ExternalHttpRequest(tracingPlugin.getTracer(), request.getMethod().toString(), removeQuery(request.getURI()), request.getURI().getHost(), request.getURI().getPort()).createScope();
  try {
    Profiler.start(request.getMethod().toString() + " " + request.getURI() + " ");
    tracingPlugin.getTracer().inject(scope.span().context(), Format.Builtin.HTTP_HEADERS, new SpringHttpRequestInjectAdapter(request));
    return execution.execute(request, body);
  } finally {
    Profiler.stop();
    scope.close();
  }
}
origin: stagemonitor/stagemonitor

@Override
public void onAfterAnyExecute(StatementInformation statementInformation, long timeElapsedNanos, SQLException e) {
  final Scope activeScope = tracingPlugin.getTracer().scopeManager().active();
  if (activeScope != null) {
    final Span span = activeScope.span();
    if (statementInformation.getConnectionInformation().getDataSource() instanceof DataSource && jdbcPlugin.isCollectSql()) {
      MetaData metaData = dataSourceUrlMap.get(statementInformation.getConnectionInformation().getDataSource());
      Tags.PEER_SERVICE.set(span, metaData.serviceName);
      span.setTag("db.type", metaData.productName);
      span.setTag("db.user", metaData.userName);
      if (StringUtils.isNotEmpty(statementInformation.getSql())) {
        String sql = getSql(statementInformation.getSql(), statementInformation.getSqlWithValues());
        Profiler.addIOCall(sql, timeElapsedNanos);
        span.setTag(AbstractExternalRequest.EXTERNAL_REQUEST_METHOD, getMethod(sql));
        span.setTag(DB_STATEMENT, sql);
      }
    }
    tracingPlugin.getRequestMonitor().monitorStop();
  }
}
org.stagemonitor.tracing.profilerProfiler

Most used methods

  • addIOCall
  • stop
  • activateProfiling
    Activates the profiling for the current thread by setting the provided CallStackElement as the root
  • start
  • getMethodCallParent
    Adds the current
  • isProfilingActive
  • addCall
  • clearMethodCallParent
  • deactivateProfiling

Popular in Java

  • Updating database using SQL prepared statement
  • getSharedPreferences (Context)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now