public void data(String k, String v) { if (span != null) span.addKVAnnotation(k.getBytes(UTF_8), v.getBytes(UTF_8)); }
public static void addAnnotation(Span span, String message, int value) { span.addKVAnnotation(message.getBytes(), Bytes.toBytes(Integer.toString(value))); }
/** * Add data to the current span. */ public static void data(String k, String v) { org.apache.htrace.Span span = org.apache.htrace.Trace.currentSpan(); if (span != null) span.addKVAnnotation(k.getBytes(UTF_8), v.getBytes(UTF_8)); }
private static void addCustomAnnotationsToSpan(@Nullable Span span, @NotNull PhoenixConnection conn) { Preconditions.checkNotNull(conn); if (span == null) { return; } Map<String, String> annotations = conn.getCustomTracingAnnotations(); // copy over the annotations as bytes for (Map.Entry<String, String> annotation : annotations.entrySet()) { span.addKVAnnotation(toBytes(annotation.getKey()), toBytes(annotation.getValue())); } }
protected Span createNewSpan(long traceid, long parentid, long spanid, String description, long startTime, long endTime, String processid, String... tags) { Span span = new MilliSpan.Builder().description(description).traceId(traceid) .parents(new long[] { parentid }).spanId(spanid).processId(processid) .begin(startTime).end(endTime).build(); int tagCount = 0; for (String annotation : tags) { span.addKVAnnotation((Integer.toString(tagCount++)).getBytes(), annotation.getBytes()); } return span; }
/** * For PHOENIX-1126, Phoenix originally assumed all the annotation values were integers, * but HBase writes some strings as well, so we need to be able to handle that too */ @Test public void testNonIntegerAnnotations(){ Span span = getSpan(); // make sure its less than the length of an integer byte[] value = Bytes.toBytes("a"); byte[] someInt = Bytes.toBytes(1); assertTrue(someInt.length > value.length); // an annotation that is not an integer span.addKVAnnotation(Bytes.toBytes("key"), value); // Create the sink and write the span TraceSpanReceiver source = new TraceSpanReceiver(); Trace.addReceiver(source); Tracer.getInstance().deliver(span); assertTrue(source.getNumSpans() == 1); }
public void data(String k, String v) { if (span != null) span.addKVAnnotation(k.getBytes(UTF_8), v.getBytes(UTF_8)); }
public static void addAnnotation(Span span, String message, int value) { span.addKVAnnotation(message.getBytes(), Bytes.toBytes(Integer.toString(value))); }
public static void addAnnotation(Span span, String message, int value) { span.addKVAnnotation(message.getBytes(), Bytes.toBytes(Integer.toString(value))); }
/** * Adds a data annotation to the current span if tracing is currently on. */ public static void addKVAnnotation(byte[] key, byte[] value) { Span s = currentSpan(); if (s != null) { s.addKVAnnotation(key, value); } }
/** * Add data to the current span. */ public static void data(String k, String v) { org.apache.htrace.Span span = org.apache.htrace.Trace.currentSpan(); if (span != null) span.addKVAnnotation(k.getBytes(UTF_8), v.getBytes(UTF_8)); }
TraceScope getSrcDstTraceScope(String description, String src, String dst) { TraceScope scope = Trace.startSpan(description, traceSampler); Span span = scope.getSpan(); if (span != null) { if (src != null) { span.addKVAnnotation(SRC, src.getBytes(Charset.forName("UTF-8"))); } if (dst != null) { span.addKVAnnotation(DST, dst.getBytes(Charset.forName("UTF-8"))); } } return scope; } }
TraceScope getSrcDstTraceScope(String description, String src, String dst) { TraceScope scope = Trace.startSpan(description, traceSampler); Span span = scope.getSpan(); if (span != null) { if (src != null) { span.addKVAnnotation(SRC, src.getBytes(Charset.forName("UTF-8"))); } if (dst != null) { span.addKVAnnotation(DST, dst.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; }
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; }
private static void addCustomAnnotationsToSpan(@Nullable Span span, @NotNull PhoenixConnection conn) { Preconditions.checkNotNull(conn); if (span == null) { return; } Map<String, String> annotations = conn.getCustomTracingAnnotations(); // copy over the annotations as bytes for (Map.Entry<String, String> annotation : annotations.entrySet()) { span.addKVAnnotation(toBytes(annotation.getKey()), toBytes(annotation.getValue())); } }
private static void addCustomAnnotationsToSpan(@Nullable Span span, @NotNull PhoenixConnection conn) { Preconditions.checkNotNull(conn); if (span == null) { return; } Map<String, String> annotations = conn.getCustomTracingAnnotations(); // copy over the annotations as bytes for (Map.Entry<String, String> annotation : annotations.entrySet()) { span.addKVAnnotation(toBytes(annotation.getKey()), toBytes(annotation.getValue())); } }
scope.getSpan().addKVAnnotation(SEEK_RANGE, range.toString().getBytes(StandardCharsets.UTF_8)); try { writeWrapper(true/*, initialSeek*/);