Class AbstractHttpHandler<Q,​P>

  • Direct Known Subclasses:
    HttpClientHandler, HttpServerHandler

    abstract class AbstractHttpHandler<Q,​P>
    extends java.lang.Object
    Base class for handling request on http client and server.
    • Constructor Detail

      • AbstractHttpHandler

        AbstractHttpHandler​(HttpExtractor<Q,​P> extractor)
        Constructor to allow access from same package subclasses only.
    • Method Detail

      • recordMessageEvent

        static void recordMessageEvent​(Span span,
                                       long id,
                                       MessageEvent.Type type,
                                       long uncompressedMessageSize,
                                       long compressedMessageSize)
        A convenience to record a MessageEvent with given parameters.
        Parameters:
        span - the span which this MessageEvent will be added to.
        id - the id of the event.
        type - the MessageEvent.Type of the event.
        uncompressedMessageSize - size of the message before compressed (optional).
        compressedMessageSize - size of the message after compressed (optional).
        Since:
        0.19
      • putAttributeIfNotEmptyOrNull

        private static void putAttributeIfNotEmptyOrNull​(Span span,
                                                         java.lang.String key,
                                                         @Nullable
                                                         java.lang.String value)
      • handleMessageSent

        public final void handleMessageSent​(HttpRequestContext context,
                                            long bytes)
        Instrument an HTTP span after a message is sent. Typically called for every chunk of request or response is sent.
        Parameters:
        context - request specific HttpRequestContext
        bytes - bytes sent.
        Since:
        0.19
      • handleMessageReceived

        public final void handleMessageReceived​(HttpRequestContext context,
                                                long bytes)
        Instrument an HTTP span after a message is received. Typically called for every chunk of request or response is received.
        Parameters:
        context - request specific HttpRequestContext
        bytes - bytes received.
        Since:
        0.19
      • spanEnd

        void spanEnd​(Span span,
                     int httpStatus,
                     @Nullable
                     java.lang.Throwable error)
      • getSpanName

        final java.lang.String getSpanName​(Q request,
                                           HttpExtractor<Q,​P> extractor)
      • addSpanRequestAttributes

        final void addSpanRequestAttributes​(Span span,
                                            Q request,
                                            HttpExtractor<Q,​P> extractor)