public Span(TraceScope scope) { this.scope = scope; this.span = scope.getSpan(); }
@Override public Tuple next() throws SQLException { if (!started) { scope.getSpan().addTimelineAnnotation("First request completed"); started = true; } return super.next(); }
/** * 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); } }
Span span = ts1.getSpan(); System.out.println("Span Time: " + span.getAccumulatedMillis()); System.out.println("Span: " + span);
if (traceScope.getSpan() != null) { conn.setTraceScope(traceScope); } else { conn.setSampler(Sampler.NEVER); if (traceScope == null || traceScope.getSpan() == null) return null; first = false; ImmutableBytesWritable ptr = new ImmutableBytesWritable(); ParseNodeFactory factory = new ParseNodeFactory(); LiteralParseNode literal = factory.literal(traceScope.getSpan().getTraceId()); LiteralExpression expression = LiteralExpression.newConstant(literal.getValue(), PLong.INSTANCE,
public Span(TraceScope scope) { this.scope = scope; this.span = scope.getSpan(); }
assertTrue(rs.next()); PhoenixConnection pconn = (PhoenixConnection) conn1; long traceId = pconn.getTraceScope().getSpan().getTraceId(); assertEquals(traceId, rs.getLong(1)); assertEquals(traceId, rs.getLong("trace_id")); traceId = pconn.getTraceScope().getSpan() .getTraceId(); assertEquals(traceId, rs.getLong(1));
Span current = scope.getSpan(); if (current == null) { current = NullSpan.INSTANCE;
Span span = trace.getSpan(); ImmutableBytesWritable indexMetaDataPtr = new ImmutableBytesWritable(); while (tableRefIterator.hasNext()) {
Span current = scope.getSpan(); if (current == null) { current = NullSpan.INSTANCE;
final Span child = Trace.startSpan(SCANNER_OPENED_TRACE_INFO, savedSpan).getSpan(); try { RegionScanner scanner = doPostScannerOpen(c, scan, delegate);
Span span = trace.getSpan();
TraceScope getPathTraceScope(String description, String path) { TraceScope scope = Trace.startSpan(description, traceSampler); Span span = scope.getSpan(); if (span != null) { if (path != null) { span.addKVAnnotation(PATH, path.getBytes(Charset.forName("UTF-8"))); } } return scope; }
TraceScope getPathTraceScope(String description, String path) { TraceScope scope = Trace.startSpan(description, traceSampler); Span span = scope.getSpan(); if (span != null) { if (path != null) { span.addKVAnnotation(PATH, path.getBytes(Charset.forName("UTF-8"))); } } return scope; }
@Override public Tuple next() throws SQLException { if (!started) { scope.getSpan().addTimelineAnnotation("First request completed"); started = true; } return super.next(); }
@Override public Tuple next() throws SQLException { if (!started) { scope.getSpan().addTimelineAnnotation("First request completed"); started = true; } return super.next(); }
TraceScope scope = Tracing.startNewSpan(context.getConnection(), "Creating basic query for " + getPlanSteps(iterator)); if (scope.getSpan() != null) return new TracingIterator(scope, iterator);