Interface HttpServerResponseCustomizer


public interface HttpServerResponseCustomizer
HttpServerResponseCustomizer can be used to execute code after an HTTP server response is created for the purpose of mutating the response in some way, such as appending headers, that may depend on the context of the SERVER span.

This is a service provider interface that requires implementations to be registered in a provider-configuration file stored in the META-INF/services resource directory.

  • Method Summary

    Modifier and Type
    Method
    Description
    <RESPONSE> void
    customize(io.opentelemetry.context.Context serverContext, RESPONSE response, HttpServerResponseMutator<RESPONSE> responseMutator)
    Called for each HTTP server response with its SERVER span context provided.
  • Method Details

    • customize

      <RESPONSE> void customize(io.opentelemetry.context.Context serverContext, RESPONSE response, HttpServerResponseMutator<RESPONSE> responseMutator)
      Called for each HTTP server response with its SERVER span context provided. This is called at a time when response headers can already be set, but the response is not yet committed, which is typically at the start of request handling.
      Parameters:
      serverContext - Context of a SERVER span SpanContext
      response - Response object specific to the library being instrumented
      responseMutator - Mutator through which the provided response object can be mutated