Class NoOpLLMObsSpan

java.lang.Object
datadog.trace.api.llmobs.noop.NoOpLLMObsSpan
All Implemented Interfaces:
LLMObsSpan

public class NoOpLLMObsSpan extends Object implements LLMObsSpan
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final LLMObsSpan
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Annotate the span with a throwable
    void
    annotateIO(String inputData, String outputData)
    Annotate the span with inputs and outputs
    void
    Annotate the span with inputs and outputs for LLM spans
    void
    Finishes (closes) a span
    long
    Gets the SpanId.
    Gets the TraceId of the span's trace.
    void
    setError(boolean error)
    Annotate the span to indicate that an error occurred
    void
    setErrorMessage(String errorMessage)
    Annotate the span with an error message
    void
    Annotate the span with metadata
    void
    setMetric(CharSequence key, double value)
    Annotate the span with a single metric key value pair for the span’s context (number of tokens document length, etc).
    void
    setMetric(CharSequence key, int value)
    Annotate the span with a single metric key value pair for the span’s context (number of tokens document length, etc).
    void
    setMetric(CharSequence key, long value)
    Annotate the span with a single metric key value pair for the span’s context (number of tokens document length, etc).
    void
    Annotate the span with metrics
    void
    setTag(String key, boolean value)
    Annotate the span with a single tag key value pair as a tag regarding the span’s context (session, environment, system, versioning, etc.).
    void
    setTag(String key, double value)
    Annotate the span with a single tag key value pair as a tag regarding the span’s context (session, environment, system, versioning, etc.).
    void
    setTag(String key, int value)
    Annotate the span with a single tag key value pair as a tag regarding the span’s context (session, environment, system, versioning, etc.).
    void
    setTag(String key, long value)
    Annotate the span with a single tag key value pair as a tag regarding the span’s context (session, environment, system, versioning, etc.).
    void
    setTag(String key, String value)
    Annotate the span with a single tag key value pair as a tag regarding the span’s context (session, environment, system, versioning, etc.).
    void
    Annotate the span with tags

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • INSTANCE

      public static final LLMObsSpan INSTANCE
  • Constructor Details

    • NoOpLLMObsSpan

      public NoOpLLMObsSpan()
  • Method Details

    • annotateIO

      public void annotateIO(List<LLMObs.LLMMessage> inputData, List<LLMObs.LLMMessage> outputData)
      Description copied from interface: LLMObsSpan
      Annotate the span with inputs and outputs for LLM spans
      Specified by:
      annotateIO in interface LLMObsSpan
      Parameters:
      inputData - The input messages of the span in the form of a list
      outputData - The output messages of the span in the form of a list
    • annotateIO

      public void annotateIO(String inputData, String outputData)
      Description copied from interface: LLMObsSpan
      Annotate the span with inputs and outputs
      Specified by:
      annotateIO in interface LLMObsSpan
      Parameters:
      inputData - The input data of the span in the form of a string
      outputData - The output data of the span in the form of a string
    • setMetadata

      public void setMetadata(Map<String,Object> metadata)
      Description copied from interface: LLMObsSpan
      Annotate the span with metadata
      Specified by:
      setMetadata in interface LLMObsSpan
      Parameters:
      metadata - A map of JSON serializable key-value pairs that contains metadata information relevant to the input or output operation described by the span
    • setMetrics

      public void setMetrics(Map<String,Number> metrics)
      Description copied from interface: LLMObsSpan
      Annotate the span with metrics
      Specified by:
      setMetrics in interface LLMObsSpan
      Parameters:
      metrics - A map of JSON serializable keys and numeric values that users can add as metrics relevant to the operation described by the span (input_tokens, output_tokens, total_tokens, etc.).
    • setMetric

      public void setMetric(CharSequence key, int value)
      Description copied from interface: LLMObsSpan
      Annotate the span with a single metric key value pair for the span’s context (number of tokens document length, etc).
      Specified by:
      setMetric in interface LLMObsSpan
      Parameters:
      key - the name of the metric
      value - the value of the metric
    • setMetric

      public void setMetric(CharSequence key, long value)
      Description copied from interface: LLMObsSpan
      Annotate the span with a single metric key value pair for the span’s context (number of tokens document length, etc).
      Specified by:
      setMetric in interface LLMObsSpan
      Parameters:
      key - the name of the metric
      value - the value of the metric
    • setMetric

      public void setMetric(CharSequence key, double value)
      Description copied from interface: LLMObsSpan
      Annotate the span with a single metric key value pair for the span’s context (number of tokens document length, etc).
      Specified by:
      setMetric in interface LLMObsSpan
      Parameters:
      key - the name of the metric
      value - the value of the metric
    • setTags

      public void setTags(Map<String,Object> tags)
      Description copied from interface: LLMObsSpan
      Annotate the span with tags
      Specified by:
      setTags in interface LLMObsSpan
      Parameters:
      tags - An map of JSON serializable key-value pairs that users can add as tags regarding the span’s context (session, environment, system, versioning, etc.).
    • setTag

      public void setTag(String key, String value)
      Description copied from interface: LLMObsSpan
      Annotate the span with a single tag key value pair as a tag regarding the span’s context (session, environment, system, versioning, etc.).
      Specified by:
      setTag in interface LLMObsSpan
      Parameters:
      key - the key of the tag
      value - the value of the tag
    • setTag

      public void setTag(String key, boolean value)
      Description copied from interface: LLMObsSpan
      Annotate the span with a single tag key value pair as a tag regarding the span’s context (session, environment, system, versioning, etc.).
      Specified by:
      setTag in interface LLMObsSpan
      Parameters:
      key - the key of the tag
      value - the value of the tag
    • setTag

      public void setTag(String key, int value)
      Description copied from interface: LLMObsSpan
      Annotate the span with a single tag key value pair as a tag regarding the span’s context (session, environment, system, versioning, etc.).
      Specified by:
      setTag in interface LLMObsSpan
      Parameters:
      key - the key of the tag
      value - the value of the tag
    • setTag

      public void setTag(String key, long value)
      Description copied from interface: LLMObsSpan
      Annotate the span with a single tag key value pair as a tag regarding the span’s context (session, environment, system, versioning, etc.).
      Specified by:
      setTag in interface LLMObsSpan
      Parameters:
      key - the key of the tag
      value - the value of the tag
    • setTag

      public void setTag(String key, double value)
      Description copied from interface: LLMObsSpan
      Annotate the span with a single tag key value pair as a tag regarding the span’s context (session, environment, system, versioning, etc.).
      Specified by:
      setTag in interface LLMObsSpan
      Parameters:
      key - the key of the tag
      value - the value of the tag
    • setError

      public void setError(boolean error)
      Description copied from interface: LLMObsSpan
      Annotate the span to indicate that an error occurred
      Specified by:
      setError in interface LLMObsSpan
      Parameters:
      error - whether an error occurred
    • setErrorMessage

      public void setErrorMessage(String errorMessage)
      Description copied from interface: LLMObsSpan
      Annotate the span with an error message
      Specified by:
      setErrorMessage in interface LLMObsSpan
      Parameters:
      errorMessage - the message of the error
    • addThrowable

      public void addThrowable(Throwable throwable)
      Description copied from interface: LLMObsSpan
      Annotate the span with a throwable
      Specified by:
      addThrowable in interface LLMObsSpan
      Parameters:
      throwable - the errored throwable
    • finish

      public void finish()
      Description copied from interface: LLMObsSpan
      Finishes (closes) a span
      Specified by:
      finish in interface LLMObsSpan
    • getTraceId

      public DDTraceId getTraceId()
      Description copied from interface: LLMObsSpan
      Gets the TraceId of the span's trace.
      Specified by:
      getTraceId in interface LLMObsSpan
      Returns:
      The TraceId of the span's trace, or DDTraceId.ZERO if not set.
    • getSpanId

      public long getSpanId()
      Description copied from interface: LLMObsSpan
      Gets the SpanId.
      Specified by:
      getSpanId in interface LLMObsSpan
      Returns:
      The span identifier.