Class GrpcTelemetryBuilder

java.lang.Object
io.opentelemetry.instrumentation.grpc.v1_6.GrpcTelemetryBuilder

public final class GrpcTelemetryBuilder extends Object
A builder of GrpcTelemetry.
  • Method Details

    • addAttributeExtractor

      @CanIgnoreReturnValue public GrpcTelemetryBuilder addAttributeExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super GrpcRequest,? super io.grpc.Status> attributesExtractor)
      Adds an additional AttributesExtractor to invoke to set attributes to instrumented items. The AttributesExtractor will be executed after all default extractors.
    • addClientAttributeExtractor

      @CanIgnoreReturnValue public GrpcTelemetryBuilder addClientAttributeExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super GrpcRequest,? super io.grpc.Status> attributesExtractor)
      Adds an extra client-only AttributesExtractor to invoke to set attributes to instrumented items. The AttributesExtractor will be executed after all default extractors.
    • addServerAttributeExtractor

      @CanIgnoreReturnValue public GrpcTelemetryBuilder addServerAttributeExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super GrpcRequest,? super io.grpc.Status> attributesExtractor)
      Adds an extra server-only AttributesExtractor to invoke to set attributes to instrumented items. The AttributesExtractor will be executed after all default extractors.
    • setClientSpanNameExtractor

      @CanIgnoreReturnValue public GrpcTelemetryBuilder setClientSpanNameExtractor(Function<io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<GrpcRequest>,? extends io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<? super GrpcRequest>> clientSpanNameExtractor)
      Sets custom client SpanNameExtractor via transform function.
    • setServerSpanNameExtractor

      @CanIgnoreReturnValue public GrpcTelemetryBuilder setServerSpanNameExtractor(Function<io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<GrpcRequest>,? extends io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<? super GrpcRequest>> serverSpanNameExtractor)
      Sets custom server SpanNameExtractor via transform function.
    • setPeerService

      @CanIgnoreReturnValue public GrpcTelemetryBuilder setPeerService(String peerService)
      Sets the peer.service attribute for http client spans.
    • setCaptureExperimentalSpanAttributes

      @CanIgnoreReturnValue public GrpcTelemetryBuilder setCaptureExperimentalSpanAttributes(boolean captureExperimentalSpanAttributes)
      Sets whether experimental attributes should be set to spans. These attributes may be changed or removed in the future, so only enable this if you know you do not require attributes filled by this instrumentation to be stable across versions
    • setCapturedClientRequestMetadata

      @CanIgnoreReturnValue public GrpcTelemetryBuilder setCapturedClientRequestMetadata(List<String> capturedClientRequestMetadata)
      Sets which metadata request values should be captured as span attributes on client spans.
    • setCapturedServerRequestMetadata

      @CanIgnoreReturnValue public GrpcTelemetryBuilder setCapturedServerRequestMetadata(List<String> capturedServerRequestMetadata)
      Sets which metadata request values should be captured as span attributes on server spans.
    • build

      public GrpcTelemetry build()
      Returns a new GrpcTelemetry with the settings of this GrpcTelemetryBuilder.