Class GenAiAttributesExtractor<REQUEST,RESPONSE>

java.lang.Object
io.opentelemetry.instrumentation.api.incubator.semconv.genai.GenAiAttributesExtractor<REQUEST,RESPONSE>
All Implemented Interfaces:
io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>

public final class GenAiAttributesExtractor<REQUEST,RESPONSE> extends Object implements io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>
Extractor of GenAI attributes.

This class delegates to a type-specific GenAiAttributesGetter for individual attribute extraction from request/response objects.

  • Method Summary

    Modifier and Type
    Method
    Description
    static <REQUEST, RESPONSE>
    io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>
    create(GenAiAttributesGetter<REQUEST,RESPONSE> attributesGetter)
    Creates the GenAI attributes extractor.
    void
    onEnd(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context context, REQUEST request, RESPONSE response, Throwable error)
     
    void
    onStart(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context parentContext, REQUEST request)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • create

      public static <REQUEST, RESPONSE> io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE> create(GenAiAttributesGetter<REQUEST,RESPONSE> attributesGetter)
      Creates the GenAI attributes extractor.
    • onStart

      public void onStart(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context parentContext, REQUEST request)
      Specified by:
      onStart in interface io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>
    • onEnd

      public void onEnd(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context context, REQUEST request, @Nullable RESPONSE response, @Nullable Throwable error)
      Specified by:
      onEnd in interface io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>