public interface LLMObsSpan
| Modifier and Type | Method and Description |
|---|---|
void |
addThrowable(Throwable throwable)
Annotate the span with a throwable
|
void |
annotateIO(List<LLMObs.LLMMessage> inputMessages,
List<LLMObs.LLMMessage> outputMessages)
Annotate the span with inputs and outputs for LLM spans
|
void |
annotateIO(String inputData,
String outputData)
Annotate the span with inputs and outputs
|
void |
finish()
Finishes (closes) a span
|
long |
getSpanId()
Gets the SpanId.
|
DDTraceId |
getTraceId()
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 |
setMetadata(Map<String,Object> metadata)
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 |
setMetrics(Map<String,Number> metrics)
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 |
setTags(Map<String,Object> tags)
Annotate the span with tags
|
void annotateIO(List<LLMObs.LLMMessage> inputMessages, List<LLMObs.LLMMessage> outputMessages)
inputMessages - The input messages of the span in the form of a listoutputMessages - The output messages of the span in the form of a listvoid annotateIO(String inputData, String outputData)
inputData - The input data of the span in the form of a stringoutputData - The output data of the span in the form of a stringvoid setMetadata(Map<String,Object> metadata)
metadata - A map of JSON serializable key-value pairs that contains metadata information
relevant to the input or output operation described by the spanvoid setMetrics(Map<String,Number> metrics)
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.).void setMetric(CharSequence key, int value)
key - the name of the metricvalue - the value of the metricvoid setMetric(CharSequence key, long value)
key - the name of the metricvalue - the value of the metricvoid setMetric(CharSequence key, double value)
key - the name of the metricvalue - the value of the metricvoid setTags(Map<String,Object> tags)
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.).void setTag(String key, String value)
key - the key of the tagvalue - the value of the tagvoid setTag(String key, boolean value)
key - the key of the tagvalue - the value of the tagvoid setTag(String key, int value)
key - the key of the tagvalue - the value of the tagvoid setTag(String key, long value)
key - the key of the tagvalue - the value of the tagvoid setTag(String key, double value)
key - the key of the tagvalue - the value of the tagvoid setError(boolean error)
error - whether an error occurredvoid setErrorMessage(String errorMessage)
errorMessage - the message of the errorvoid addThrowable(Throwable throwable)
throwable - the errored throwablevoid finish()
DDTraceId getTraceId()
DDTraceId.ZERO if not set.long getSpanId()