/** Internal api for submitting an address. */ void submitAddress(String key, Endpoint endpoint) { Span span = currentSpan().get(); if (span == null) return; recorder().address(span, key, endpoint); }
/** * Binary annotations are tags applied to a Span to give it context. For * example, a key "your_app.version" would let you lookup spans by version. * * @param key Name used to lookup spans, such as "your_app.version" * @param value String value, should not be <code>null</code>. */ public void submitBinaryAnnotation(String key, String value) { Span span = currentSpan().get(); if (span == null) return; recorder().tag(span, key, value); }
/** * Associates an event that explains latency with a timestamp. * * <p/> This is an alternative to {@link #submitAnnotation(String)}, when * you have a timestamp more precise or accurate than {@link System#currentTimeMillis()}. * * @param value A short tag indicating the event, like "finagle.retry" * @param timestamp microseconds from epoch */ public void submitAnnotation(String value, long timestamp) { Span span = currentSpan().get(); if (span == null) return; recorder().annotate(span, timestamp, value); }
@Nullable SpanId maybeParent() { Span parentSpan = currentLocalSpan().get(); if (parentSpan == null) { Span serverSpan = currentServerSpan().get(); if (serverSpan != null) { parentSpan = serverSpan; } } if (parentSpan == null) return null; return Brave.context(parentSpan); }
/** * Associates an event that explains latency with the current system time. * * @param value A short tag indicating the event, like "finagle.retry" */ public void submitAnnotation(String value) { Span span = currentSpan().get(); if (span == null) return; recorder().annotate(span, recorder().currentTimeMicroseconds(span), value); }
/** This adds an annotation that corresponds with {@link Span#getTimestamp()} */ void submitStartAnnotation(String startAnnotation) { Span span = currentSpan().get(); if (span == null) return; long timestamp = recorder().currentTimeMicroseconds(span); recorder().annotate(span, timestamp, startAnnotation); recorder().start(span, timestamp); }
/** * This adds an annotation that corresponds with {@link Span#getDuration()}, and sends the span * for collection. * * @return true if a span was sent for collection. */ boolean submitEndAnnotation(String finishAnnotation) { Span span = currentSpan().get(); if (span == null) return false; long timestamp = recorder().currentTimeMicroseconds(span); recorder().annotate(span, timestamp, finishAnnotation); recorder().finish(span, timestamp); return true; }