|
| 1 | +package rocks.inspectit.agent.java.sdk.opentracing; |
| 2 | + |
| 3 | +import io.opentracing.Tracer; |
| 4 | +import io.opentracing.propagation.Format; |
| 5 | +import rocks.inspectit.agent.java.sdk.opentracing.propagation.Propagator; |
| 6 | + |
| 7 | +/** |
| 8 | + * This interface defines additional methods that inspectIT tracer provides for usage. |
| 9 | + * <p> |
| 10 | + * There are additional two methods for creating a {@link SpanBuilder} where user can choose if |
| 11 | + * current thread context should be referenced or not. |
| 12 | + * <p> |
| 13 | + * The tracer allows registration of the {@link Propagator} for a specific format. This method |
| 14 | + * allows overwriting of the tracer default propagators. Note that inspectIT tracer by default uses |
| 15 | + * {@link rocks.inspectit.agent.java.sdk.opentracing.internal.propagation.TextMapPropagator} for the |
| 16 | + * <code>io.opentracing.propagation.Format.Builtin.TEXT_MAP</code> and |
| 17 | + * {@link rocks.inspectit.agent.java.sdk.opentracing.internal.propagation.UrlEncodingPropagator} for |
| 18 | + * the <code>io.opentracing.propagation.Format.Builtin.HTTP_HEADERS</code> format. |
| 19 | + * |
| 20 | + * @author Ivan Senic |
| 21 | + * |
| 22 | + */ |
| 23 | +public interface ExtendedTracer extends Tracer { |
| 24 | + |
| 25 | + /** |
| 26 | + * Registers propagator. This method allows overwriting of the tracer default propagators. Note |
| 27 | + * that inspectIT tracer by default uses |
| 28 | + * {@link rocks.inspectit.agent.java.sdk.opentracing.internal.propagation.TextMapPropagator} for |
| 29 | + * the <code>io.opentracing.propagation.Format.Builtin.TEXT_MAP</code> and |
| 30 | + * {@link rocks.inspectit.agent.java.sdk.opentracing.internal.propagation.UrlEncodingPropagator} |
| 31 | + * for the <code>io.opentracing.propagation.Format.Builtin.HTTP_HEADERS</code> format. |
| 32 | + * |
| 33 | + * @param <C> |
| 34 | + * format type |
| 35 | + * @param format |
| 36 | + * opentracing {@link Format} |
| 37 | + * @param propagator |
| 38 | + * {@link Propagator} |
| 39 | + */ |
| 40 | + <C> void registerPropagator(Format<C> format, Propagator<C> propagator); |
| 41 | + |
| 42 | + /** |
| 43 | + * Sets the implementation of the {@link Timer} to use. |
| 44 | + * <p> |
| 45 | + * By default inspectIT tracer uses |
| 46 | + * {@link rocks.inspectit.agent.java.sdk.opentracing.util.SystemTimer} that has millisecond |
| 47 | + * start time precision. This done so inspectIT can be compatible with Java 6. Users can provide |
| 48 | + * better timers if they run on higher Java versions or have third party dependencies that could |
| 49 | + * do better. |
| 50 | + * |
| 51 | + * @param timer |
| 52 | + * {@link Timer} to set. Must not be <code>null</code>. |
| 53 | + * @throws IllegalArgumentException |
| 54 | + * If timer provided is <code>null</code>. |
| 55 | + */ |
| 56 | + void setTimer(Timer timer) throws IllegalArgumentException; |
| 57 | + |
| 58 | + /** |
| 59 | + * Builds span with no operation name. The thread context reference will added if the one exists |
| 60 | + * as the CHILD_OF reference. |
| 61 | + * |
| 62 | + * @return {@link SpanBuilder}. |
| 63 | + */ |
| 64 | + SpanBuilder buildSpan(); |
| 65 | + |
| 66 | + /** |
| 67 | + * Creates {@link SpanBuilder} that optionally adds the reference to the current thread context |
| 68 | + * span. |
| 69 | + * |
| 70 | + * @param operationName |
| 71 | + * Operation name of the span. |
| 72 | + * @param referenceType |
| 73 | + * Reference type to the current context. Can be <code>null</code> if |
| 74 | + * <code>useThreadContext=false</code> |
| 75 | + * @param useThreadContext |
| 76 | + * If thread context should be used. |
| 77 | + * @return {@link SpanBuilder}. |
| 78 | + */ |
| 79 | + SpanBuilder buildSpan(String operationName, String referenceType, boolean useThreadContext); |
| 80 | + |
| 81 | +} |
0 commit comments