Tabnine Logo
Tracer.close
Code IndexAdd Tabnine to your IDE (free)

How to use
close
method
in
org.apache.htrace.core.Tracer

Best Java code snippets using org.apache.htrace.core.Tracer.close (Showing top 20 results out of 315)

origin: org.apache.hadoop/hadoop-common

@VisibleForTesting
public static synchronized void clear() {
 if (instance == null) {
  return;
 }
 try {
  instance.close();
 } finally {
  instance = null;
 }
}
origin: org.apache.hadoop/hadoop-common

tracer.close();
return exitCode;
origin: org.apache.hadoop/hadoop-hdfs

tracer.close();
tracer = null;
origin: org.apache.hadoop/hadoop-hdfs

tracer.close();
origin: org.apache.hadoop/hadoop-hdfs

tracer.close();
origin: io.hops/hadoop-common

@VisibleForTesting
public static synchronized void clear() {
 if (instance == null) {
  return;
 }
 try {
  instance.close();
 } finally {
  instance = null;
 }
}
origin: io.hops/hadoop-common

tracer.close();
return exitCode;
origin: apache/incubator-htrace

Thread.sleep(10);
parent.close();
tracer.close();
System.out.println("trace id: " + traceid);
origin: apache/incubator-htrace

private List<SpanReceiver> createSpanReceivers(String classes) {
 Tracer tracer = new Tracer.Builder().
   name("MyTracer").
   tracerPool(new TracerPool("createSpanReceivers")).
   conf(HTraceConfiguration.fromKeyValuePairs(
     "span.receiver.classes", classes)).
   build();
 SpanReceiver[] receivers = tracer.getTracerPool().getReceivers();
 tracer.close();
 LinkedList<SpanReceiver> receiverList = new LinkedList<SpanReceiver>();
 for (SpanReceiver item: receivers) {
  receiverList.add(item);
 }
 return receiverList;
}
origin: apache/incubator-htrace

private Sampler[] getSamplersFromConf(HTraceConfiguration conf) {
 Tracer tracer = new Tracer.Builder().
   name("MyTracer").
   tracerPool(new TracerPool("getSamplersFromConf")).
   conf(conf).
   build();
 Sampler[] samplers = tracer.getSamplers();
 tracer.close();
 return samplers;
}
origin: apache/incubator-htrace

 @Test
 public void testWriteToLocalFile() throws IOException {
  String traceFileName = LocalFileSpanReceiver.getUniqueLocalTraceFileName();
  Tracer tracer = new Tracer.Builder().
    name("testWriteToLocalFileTracer").
    tracerPool(new TracerPool("testWriteToLocalFile")).
    conf(HTraceConfiguration.fromKeyValuePairs(
      "sampler.classes", "AlwaysSampler",
      "span.receiver.classes", LocalFileSpanReceiver.class.getName(),
      "local.file.span.receiver.path", traceFileName,
      "tracer.id", "%{tname}")).
    build();
  TraceScope scope = tracer.newScope("testWriteToLocalFile");
  scope.close();
  tracer.close();

  ObjectMapper mapper = new ObjectMapper();
  MilliSpan span = mapper.readValue(new File(traceFileName), MilliSpan.class);
  assertEquals("testWriteToLocalFile", span.getDescription());
  assertEquals("testWriteToLocalFileTracer", span.getTracerId());
 }
}
origin: apache/incubator-htrace

traceCreator.createSimpleTrace();
traceCreator.createThreadedTrace();
tracer.close();
TraceGraph traceGraph = new TraceGraph(receiver.getSpans());
Collection<Span> roots = traceGraph.getSpansByParent().find(SpanId.INVALID);
origin: apache/incubator-htrace

@Test
public void TestTracerCreateAndClose() throws Exception {
 Tracer tracer = new Tracer.Builder().
   name("TestSimpleScope").
   tracerPool(new TracerPool("TestTracerCreateAndClose")).
   conf(HTraceConfiguration.fromKeyValuePairs(
     "sampler.classes", "AlwaysSampler")).
   build();
 POJOSpanReceiver receiver =
   new POJOSpanReceiver(HTraceConfiguration.EMPTY);
 tracer.getTracerPool().addReceiver(receiver);
 tracer.close();
 Assert.assertTrue(receiver.getSpans().isEmpty());
}
origin: apache/incubator-htrace

@Test
public void TestSimpleScope() throws Exception {
 Tracer tracer = new Tracer.Builder().
   name("TestSimpleScope").
   tracerPool(new TracerPool("TestSimpleScope")).
   conf(HTraceConfiguration.fromKeyValuePairs(
     "sampler.classes", "AlwaysSampler")).
   build();
 POJOSpanReceiver receiver =
   new POJOSpanReceiver(HTraceConfiguration.EMPTY);
 tracer.getTracerPool().addReceiver(receiver);
 TraceScope scope = tracer.newScope("Foo");
 scope.close();
 tracer.close();
 Assert.assertEquals(1, receiver.getSpans().size());
 Span span = receiver.getSpans().iterator().next();
 Assert.assertEquals(0, span.getParents().length);
}
origin: apache/incubator-htrace

/**
 * Test calling detach() two times on a scope object.
 */
@Test
public void TestDoubleDetachIsCaught() throws Exception {
 Tracer tracer = new Tracer.Builder().
   name("TestDoubleDetach").
   tracerPool(new TracerPool("TestDoubleDetachIsCaught")).
   conf(HTraceConfiguration.
     fromKeyValuePairs("sampler.classes", "AlwaysSampler")).build();
 boolean gotException = false;
 TraceScope myScope = tracer.newScope("myScope");
 myScope.detach();
 try {
  myScope.detach();
 } catch (RuntimeException e) {
  assertThat(e.getMessage(),
    containsString("it is already detached."));
  gotException = true;
 }
 assertTrue("Expected to get exception because of double TraceScope " +
   "detach.", gotException);
 tracer.close();
}
origin: apache/incubator-htrace

/**
 * Test calling detach() two times on a scope object.
 */
@Test
public void TestDoubleDetachOnNullScope() throws Exception {
 Tracer tracer = new Tracer.Builder().
   name("TestDoubleDetachOnNullScope").
   tracerPool(new TracerPool("TestDoubleDetachOnNullScope")).
   conf(HTraceConfiguration.
     fromKeyValuePairs("sampler.classes", "NeverSampler")).build();
 boolean gotException = false;
 TraceScope myScope = tracer.newScope("myScope");
 myScope.detach();
 try {
  myScope.detach();
 } catch (RuntimeException e) {
  assertThat(e.getMessage(),
    containsString("it is already detached."));
  gotException = true;
 }
 assertTrue("Expected to get exception because of double TraceScope " +
   "detach on NullScope.", gotException);
 tracer.close();
}
origin: apache/incubator-htrace

/**
 * Test closing an outer scope when an inner one is still active.
 */
@Test
public void TestClosingOuterScope() throws Exception {
 Tracer tracer = new Tracer.Builder().
   name("TestClosingOuterScopeTracer").
   tracerPool(new TracerPool("TestClosingOuterScope")).
   conf(HTraceConfiguration.
     fromKeyValuePairs("sampler.classes", "AlwaysSampler")).build();
 boolean gotException = false;
 TraceScope outerScope = tracer.newScope("outer");
 TraceScope innerScope = tracer.newScope("inner");
 try {
  outerScope.close();
 } catch (RuntimeException e) {
  assertThat(e.getMessage(),
    containsString("it is not the current TraceScope"));
  gotException = true;
 }
 assertTrue("Expected to get exception because of improper " +
   "scope closure.", gotException);
 innerScope.close();
 tracer.close();
}
origin: apache/incubator-htrace

/**
 * Test calling reattach() two times on a scope object.
 */
@Test
public void TestDoubleReattachIsCaught() throws Exception {
 Tracer tracer = new Tracer.Builder().
   name("TestDoubleReattach").
   tracerPool(new TracerPool("TestDoubleReattachIsCaught")).
   conf(HTraceConfiguration.
     fromKeyValuePairs("sampler.classes", "AlwaysSampler")).build();
 boolean gotException = false;
 TraceScope myScope = tracer.newScope("myScope");
 myScope.detach();
 myScope.reattach();
 try {
  myScope.reattach();
 } catch (RuntimeException e) {
  assertThat(e.getMessage(),
    containsString("it is not detached."));
  gotException = true;
 }
 assertTrue("Expected to get exception because of double TraceScope " +
   "reattach.", gotException);
 tracer.close();
}
origin: apache/incubator-htrace

@Test(timeout=120000)
public void testSimpleTraces() throws IOException, InterruptedException {
 Tracer tracer = newTracer();
 Span rootSpan = new MilliSpan.Builder().
   description("root").
   spanId(new SpanId(100, 100)).
   tracerId("test").
   begin(System.currentTimeMillis()).
   build();
 TraceScope rootScope = tracer.newScope("root");
 TraceScope innerOne = tracer.newScope("innerOne");
 TraceScope innerTwo = tracer.newScope("innerTwo");
 innerTwo.close();
 Assert.assertTrue(flumeServer.nextEventBodyAsString().contains("innerTwo"));
 innerOne.close();
 Assert.assertTrue(flumeServer.nextEventBodyAsString().contains("innerOne"));
 rootSpan.addKVAnnotation("foo", "bar");
 rootSpan.addTimelineAnnotation("timeline");
 rootScope.close();
 Assert.assertTrue(flumeServer.nextEventBodyAsString().contains("root"));
 tracer.close();
}
origin: apache/incubator-htrace

@Test
public void testSimpleTraces() throws IOException, InterruptedException {
 FakeZipkinTransport transport = new FakeZipkinTransport();
 Tracer tracer = newTracer(transport);
 Span rootSpan = new MilliSpan.Builder().
   description("root").
   spanId(new SpanId(100, 100)).
   tracerId("test").
   begin(System.currentTimeMillis()).
   build();
 TraceScope rootScope = tracer.newScope("root");
 TraceScope innerOne = tracer.newScope("innerOne");
 TraceScope innerTwo = tracer.newScope("innerTwo");
 innerTwo.close();
 Assert.assertTrue(transport.nextMessageAsSpan().getName().contains("innerTwo"));
 innerOne.close();
 Assert.assertTrue(transport.nextMessageAsSpan().getName().contains("innerOne"));
 rootSpan.addKVAnnotation("foo", "bar");
 rootSpan.addTimelineAnnotation("timeline");
 rootScope.close();
 Assert.assertTrue(transport.nextMessageAsSpan().getName().contains("root"));
 tracer.close();
}
org.apache.htrace.coreTracerclose

Popular methods of Tracer

  • newScope
    Create a new trace scope. If there are no scopes above the current scope, we will apply our configur
  • getCurrentSpan
  • wrap
    Wrap the callable in a TraceCallable, if tracing.
  • curThreadTracer
    If the current thread is tracing, this function returns the Tracer that is being used; otherwise, it
  • addSampler
    Add a new Sampler.
  • getTracerPool
  • <init>
  • closeScope
  • detachScope
  • getTracerId
  • newScopeImpl
  • newTraceExecutorService
  • newScopeImpl,
  • newTraceExecutorService,
  • popNullScope,
  • reattachScope,
  • sample,
  • throwClientError,
  • toString,
  • getCurrentSpanId,
  • getSamplers

Popular in Java

  • Finding current android device location
  • requestLocationUpdates (LocationManager)
  • compareTo (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • JOptionPane (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now