Class SpringWebTelemetryBuilder

java.lang.Object
io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetryBuilder

public final class SpringWebTelemetryBuilder extends Object
A builder of SpringWebTelemetry.
  • Method Details

    • addAttributeExtractor

      @Deprecated @CanIgnoreReturnValue public SpringWebTelemetryBuilder addAttributeExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super org.springframework.http.HttpRequest,? super org.springframework.http.client.ClientHttpResponse> attributesExtractor)
      Adds an additional AttributesExtractor to invoke to set attributes to instrumented items.
    • addAttributesExtractor

      @CanIgnoreReturnValue public SpringWebTelemetryBuilder addAttributesExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super org.springframework.http.HttpRequest,? super org.springframework.http.client.ClientHttpResponse> attributesExtractor)
      Adds an additional AttributesExtractor to invoke to set attributes to instrumented items.
    • setCapturedRequestHeaders

      @CanIgnoreReturnValue public SpringWebTelemetryBuilder setCapturedRequestHeaders(Collection<String> requestHeaders)
      Configures the HTTP request headers that will be captured as span attributes.
      Parameters:
      requestHeaders - A list of HTTP header names.
    • setCapturedResponseHeaders

      @CanIgnoreReturnValue public SpringWebTelemetryBuilder setCapturedResponseHeaders(Collection<String> responseHeaders)
      Configures the HTTP response headers that will be captured as span attributes.
      Parameters:
      responseHeaders - A list of HTTP header names.
    • setSpanNameExtractor

      @CanIgnoreReturnValue public SpringWebTelemetryBuilder setSpanNameExtractor(Function<io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<? super org.springframework.http.HttpRequest>,? extends io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<? super org.springframework.http.HttpRequest>> spanNameExtractorTransformer)
      Sets custom SpanNameExtractor via transform function.
    • setKnownMethods

      @CanIgnoreReturnValue public SpringWebTelemetryBuilder setKnownMethods(Collection<String> knownMethods)
      Configures the instrumentation to recognize an alternative set of HTTP request methods.

      By default, this instrumentation defines "known" methods as the ones listed in RFC9110 and the PATCH method defined in RFC5789.

      Note: calling this method overrides the default known method sets completely; it does not supplement it.

      Parameters:
      knownMethods - A set of recognized HTTP request methods.
      See Also:
      • HttpClientAttributesExtractorBuilder.setKnownMethods(Collection)
    • setEmitExperimentalHttpClientMetrics

      @Deprecated @CanIgnoreReturnValue public SpringWebTelemetryBuilder setEmitExperimentalHttpClientMetrics(boolean emitExperimentalHttpClientMetrics)
      Configures the instrumentation to emit experimental HTTP client metrics.
      Parameters:
      emitExperimentalHttpClientMetrics - true if the experimental HTTP client metrics are to be emitted.
    • build

      public SpringWebTelemetry build()
      Returns a new SpringWebTelemetry with the settings of this SpringWebTelemetryBuilder.