Class AbstractHttpHandler<Q,P>
java.lang.Object
io.opencensus.contrib.http.AbstractHttpHandler<Q,P>
- Direct Known Subclasses:
HttpClientHandler, HttpServerHandler
Base class for handling request on http client and server.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final HttpExtractor<Q, P> TheHttpExtractorused to extract information from request/response. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractHttpHandler(HttpExtractor<Q, P> extractor) Constructor to allow access from same package subclasses only. -
Method Summary
Modifier and TypeMethodDescription(package private) final voidaddSpanRequestAttributes(Span span, Q request, HttpExtractor<Q, P> extractor) (package private) HttpRequestContextgetNewContext(Span span, TagContext tagContext) getSpanFromContext(HttpRequestContext context) RetrievesSpanfrom theHttpRequestContext.(package private) final StringgetSpanName(Q request, HttpExtractor<Q, P> extractor) final voidhandleMessageReceived(HttpRequestContext context, long bytes) Instrument an HTTP span after a message is received.final voidhandleMessageSent(HttpRequestContext context, long bytes) Instrument an HTTP span after a message is sent.private static voidputAttributeIfNotEmptyOrNull(Span span, String key, String value) (package private) static voidrecordMessageEvent(Span span, long id, MessageEvent.Type type, long uncompressedMessageSize, long compressedMessageSize) A convenience to record aMessageEventwith given parameters.(package private) void
-
Field Details
-
extractor
TheHttpExtractorused to extract information from request/response.
-
-
Constructor Details
-
AbstractHttpHandler
AbstractHttpHandler(HttpExtractor<Q, P> extractor) Constructor to allow access from same package subclasses only.
-
-
Method Details
-
recordMessageEvent
static void recordMessageEvent(Span span, long id, MessageEvent.Type type, long uncompressedMessageSize, long compressedMessageSize) A convenience to record aMessageEventwith given parameters.- Parameters:
span- the span which thisMessageEventwill be added to.id- the id of the event.type- theMessageEvent.Typeof the event.uncompressedMessageSize- size of the message before compressed (optional).compressedMessageSize- size of the message after compressed (optional).- Since:
- 0.19
-
putAttributeIfNotEmptyOrNull
-
handleMessageSent
Instrument an HTTP span after a message is sent. Typically called for every chunk of request or response is sent.- Parameters:
context- request specificHttpRequestContextbytes- bytes sent.- Since:
- 0.19
-
handleMessageReceived
Instrument an HTTP span after a message is received. Typically called for every chunk of request or response is received.- Parameters:
context- request specificHttpRequestContextbytes- bytes received.- Since:
- 0.19
-
spanEnd
-
getSpanName
-
addSpanRequestAttributes
-
getSpanFromContext
RetrievesSpanfrom theHttpRequestContext.- Parameters:
context- request specificHttpRequestContext- Returns:
Spanassociated with the request.- Since:
- 0.19
-
getNewContext
-