/** * Start a trace span with a given description with the given sampler. */ public static <T> Span on(String description, Sampler<T> sampler) { return new Span(org.apache.htrace.Trace.startSpan(description, sampler)); }
/** * Start a new span with a given name, if already tracing. */ public static Span start(String description) { return new Span(org.apache.htrace.Trace.startSpan(description)); }
/** * Continue a trace by starting a new span with a given parent and description. */ public static Span trace(TInfo info, String description) { if (info.traceId == 0) { return Span.NULL_SPAN; } TraceInfo ti = new TraceInfo(info.traceId, info.parentId); return new Span(org.apache.htrace.Trace.startSpan(description, ti)); }
/** * Start a span with the currently configured sampling frequency. Creates a new 'current' span * on this thread - the previous 'current' span will be replaced with this newly created span. * <p> * Hands back the direct span as you shouldn't be detaching the span - use {@link TraceRunnable} * instead to detach a span from this operation. * @param connection from which to read parameters * @param string description of the span to start * @return the underlying span. */ public static TraceScope startNewSpan(PhoenixConnection connection, String string) { Sampler<?> sampler = connection.getSampler(); TraceScope scope = Trace.startSpan(string, sampler); addCustomAnnotationsToSpan(scope.getSpan(), connection); return scope; }
@Override public void postBatchMutateIndispensably(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp, final boolean success) throws IOException { BatchMutateContext context = getBatchMutateContext(c); if (context == null || context.indexUpdates == null) { return; } // get the current span, or just use a null-span to avoid a bunch of if statements try (TraceScope scope = Trace.startSpan("Starting to write index updates")) { Span current = scope.getSpan(); if (current == null) { current = NullSpan.INSTANCE; } if (success) { // if miniBatchOp was successfully written, write index updates if (!context.indexUpdates.isEmpty()) { this.writer.write(context.indexUpdates, false, context.clientVersion); } current.addTimelineAnnotation("Wrote index updates"); } } catch (Throwable t) { String msg = "Failed to write index updates:" + context.indexUpdates; LOG.error(msg, t); ServerUtil.throwIOException(msg, t); } finally { removeBatchMutateContext(c); } }
private void doPostWithExceptions(ObserverContext<RegionCoprocessorEnvironment> c, BatchMutateContext context) throws IOException { //short circuit, if we don't need to do any work if (context == null || context.indexUpdates.isEmpty()) { return; } // get the current span, or just use a null-span to avoid a bunch of if statements try (TraceScope scope = Trace.startSpan("Completing index writes")) { Span current = scope.getSpan(); if (current == null) { current = NullSpan.INSTANCE; } long start = EnvironmentEdgeManager.currentTimeMillis(); current.addTimelineAnnotation("Actually doing index update for first time"); writer.writeAndKillYourselfOnFailure(context.indexUpdates, false, context.clientVersion); long duration = EnvironmentEdgeManager.currentTimeMillis() - start; if (duration >= slowIndexWriteThreshold) { if (LOG.isDebugEnabled()) { LOG.debug(getCallTooSlowMessage("indexWrite", duration, slowIndexWriteThreshold)); } metricSource.incrementNumSlowIndexWriteCalls(); } metricSource.updateIndexWriteTime(duration); } }
TraceScope ts0 = Trace.startSpan("Connection Trace", Sampler.ALWAYS); try { connection = ConnectionFactory.createConnection(conf); TraceScope ts1 = Trace.startSpan("Get Trace", Sampler.ALWAYS); // co HTraceExample-2-Start Start a span, giving it a name and sample rate. try { Get get = new Get(Bytes.toBytes("row-1")); // co HTraceExample-3-Default Perform common operations that should be traced. System.out.println("Sampler: " + sampler.getClass().getName()); TraceScope ts2 = Trace.startSpan("Scan Trace", sampler); // co HTraceExample-6-Scan Start another span with a different sampler. try { Scan scan = new Scan();
traceScope = Trace.startSpan("LockManager.getRowLock"); traceScope.getSpan().addTimelineAnnotation("Getting a lock");
try (TraceScope scope = Trace.startSpan("Starting to build index updates")) { Span current = scope.getSpan(); if (current == null) {
try (TraceScope scope = Trace.startSpan("Starting to build index updates")) { Span current = scope.getSpan(); if (current == null) {
final Span child = Trace.startSpan(SCANNER_OPENED_TRACE_INFO, savedSpan).getSpan(); try { RegionScanner scanner = doPostScannerOpen(c, scan, delegate);
public static TraceScope continueTraceSpan(DataTransferTraceInfoProto proto, String description) { TraceScope scope = null; TraceInfo info = fromProto(proto); if (info != null) { scope = Trace.startSpan(description, info); } return scope; }
TraceScope trace = Trace.startSpan("Start write test", Sampler.ALWAYS); Span span = trace.getSpan();
/** * @see ClientProtocol#finalizeUpgrade() */ public void finalizeUpgrade() throws IOException { TraceScope scope = Trace.startSpan("finalizeUpgrade", traceSampler); try { namenode.finalizeUpgrade(); } finally { scope.close(); } }
/** * Continue a trace by starting a new span with a given parent and description. */ public static Span trace(TInfo info, String description) { if (info.traceId == 0) { return Span.NULL_SPAN; } TraceInfo ti = new TraceInfo(info.traceId, info.parentId); return new Span(org.apache.htrace.Trace.startSpan(description, ti)); }
/** * @return All the existing storage policies */ public BlockStoragePolicy[] getStoragePolicies() throws IOException { TraceScope scope = Trace.startSpan("getStoragePolicies", traceSampler); try { return namenode.getStoragePolicies(); } finally { scope.close(); } }
/** * @see ClientProtocol#finalizeUpgrade() */ public void finalizeUpgrade() throws IOException { TraceScope scope = Trace.startSpan("finalizeUpgrade", traceSampler); try { namenode.finalizeUpgrade(); } finally { scope.close(); } }
public DatanodeStorageReport[] getDatanodeStorageReport( DatanodeReportType type) throws IOException { checkOpen(); TraceScope scope = Trace.startSpan("datanodeStorageReport", traceSampler); try { return namenode.getDatanodeStorageReport(type); } finally { scope.close(); } }
public long addCacheDirective( CacheDirectiveInfo info, EnumSet<CacheFlag> flags) throws IOException { checkOpen(); TraceScope scope = Trace.startSpan("addCacheDirective", traceSampler); try { return namenode.addCacheDirective(info, flags); } catch (RemoteException re) { throw re.unwrapRemoteException(); } finally { scope.close(); } }
public void addCachePool(CachePoolInfo info) throws IOException { checkOpen(); TraceScope scope = Trace.startSpan("addCachePool", traceSampler); try { namenode.addCachePool(info); } catch (RemoteException re) { throw re.unwrapRemoteException(); } finally { scope.close(); } }