package com.uber.tchannel.tracing;

import com.uber.tchannel.messages.Request;
import io.opentracing.Span;
import org.jetbrains.annotations.NotNull;

/**
 * A {@link TracingContext} implementation decorated with this interface will get an option to intercept the inbound or
 * outgoing request right after the tracing {@link Span} has been created.
 */
public interface RequestSpanInterceptor {

    /**
     * This method will be invoked right after the inbound request span has been created, allowing the implementation
     * to inspect the request and/or additional baggage from the span context.
     *
     * @throws RuntimeException
     *     if the inbound request should fail immediately
     */
    void interceptInbound(@NotNull Request request, @NotNull Span span) throws RuntimeException;

    /**
     * This method will be invoked right after the outgoing request span has been created, allowing the implementation
     * to inspect the request and/or attach additional baggage to the span context.
     *
     * @throws RuntimeException
     *     if the outbound request should fail immediately
     */
    void interceptOutbound(@NotNull Request request, @NotNull Span span) throws RuntimeException;

}

@@ -252,27 +252,26 @@
 tercept 
-the
+an
  inbound
  or%0A * o
@@ -266,14 +266,18 @@
 ound
- or
 %0A *
+ and/or
  out
@@ -343,16 +343,30 @@
  created
+ and populated
 .%0A */%0Apu
@@ -527,34 +527,34 @@
 plementation
+ to
 %0A     *
- to
  inspect the

Tweak RequestSpanInterceptor comments