Package dev.braintrust.instrumentation
Class InstrumentationSemConv
java.lang.Object
dev.braintrust.instrumentation.InstrumentationSemConv
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidtagLLMSpanRequest(io.opentelemetry.api.trace.Span span, String providerName, String baseUrl, List<String> pathSegments, String method, String requestBody) static voidtagLLMSpanRequest(io.opentelemetry.api.trace.Span span, String providerName, String baseUrl, List<String> pathSegments, String method, String requestBody, String modelId) Tag a span with LLM request metadata.static voidtagLLMSpanResponse(io.opentelemetry.api.trace.Span span, String providerName, String responseBody) static voidtagLLMSpanResponse(io.opentelemetry.api.trace.Span span, String providerName, String responseBody, Long timeToFirstTokenNanoseconds) static voidtagLLMSpanResponse(io.opentelemetry.api.trace.Span span, Throwable responseError)
-
Field Details
-
PROVIDER_NAME_OPENAI
- See Also:
-
PROVIDER_NAME_ANTHROPIC
- See Also:
-
PROVIDER_NAME_BEDROCK
- See Also:
-
PROVIDER_NAME_OTHER
- See Also:
-
UNSET_LLM_SPAN_NAME
- See Also:
-
-
Constructor Details
-
InstrumentationSemConv
public InstrumentationSemConv()
-
-
Method Details
-
tagLLMSpanRequest
-
tagLLMSpanRequest
public static void tagLLMSpanRequest(io.opentelemetry.api.trace.Span span, @Nonnull String providerName, @Nonnull String baseUrl, @Nonnull List<String> pathSegments, @Nonnull String method, @Nullable String requestBody, @Nullable String modelId) Tag a span with LLM request metadata.- Parameters:
modelId- explicit model identifier — used by providers (e.g. Bedrock) where the model is not present in the request body. Whennullthe model is extracted from the request body if possible.
-
tagLLMSpanResponse
-
tagLLMSpanResponse
-
tagLLMSpanResponse
public static void tagLLMSpanResponse(io.opentelemetry.api.trace.Span span, @Nonnull Throwable responseError)
-