spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

OpenTelemetry Semantic Conventions for GenAI Operations - Support Overview

Open ThomasVitale opened this issue 1 year ago • 3 comments
trafficstars

Based on the Semantic Conventions 1.27.0. See docs. This issue is to keep track of the work I've been doing for the Spring AI initial adoption of the OpenTelemetry Semantic Conventions for GenAI Operations.

Traces

Span Names

Span Name Spring AI Requirement
{gen_ai.operation.name} {gen_ai.request.model} Recommended

Span Kinds

Span Kind Spring AI Requirement Comments
CLIENT 🚫 Required The kind is currently INTERNAL. See discussion in https://github.com/open-telemetry/semantic-conventions/issues/1315 to understand why.

Span Attributes

Span Attribute Type Spring AI Requirement Comments
gen_ai.operation.name string Required
gen_ai.request.model string Required
gen_ai.system string Required
error.type string ⬇️ Conditionally Required if the operation ended in an error There isn't currently a plan to support it in Spring AI. You can find this information in the child HTTP span auto-configured by Spring Boot. If you encounter a use-case in production where that is not enough, we would like to hear from you. Please, let us know by raising an issue and describing your scenario, so that we can get additional context and evaluate if and how to add this attribute to meet your needs.
server.port int ⬇️ Conditionally Required If server.address is set. This attribute is optional. There isn't currently a plan to support it in Spring AI. You can find this information in the child HTTP span auto-configured by Spring Boot. If you encounter a use-case in production where that is not enough, we would like to hear from you. Please, let us know by raising an issue and describing your scenario, so that we can get additional context and evaluate if and how to add this attribute to meet your needs.
gen_ai.request.frequency_penalty double Recommended
gen_ai.request.max_tokens int Recommended
gen_ai.request.presence_penalty double Recommended
gen_ai.request.stop_sequences string[] Recommended
gen_ai.request.temperature double Recommended
gen_ai.request.top_k double Recommended
gen_ai.request.top_p double Recommended
gen_ai.response.finish_reasons string[] Recommended
gen_ai.response.id string Recommended
gen_ai.response.model string Recommended
gen_ai.usage.input_tokens int Recommended
gen_ai.usage.output_tokens int Recommended
server.address string ⬇️ Recommended This attribute is optional. There isn't currently a plan to support it in Spring AI. You can find this information in the child HTTP span auto-configured by Spring Boot. If you encounter a use-case in production where that is not enough, we would like to hear from you. Please, let us know by raising an issue and describing your scenario, so that we can get additional context and evaluate if and how to add this attribute to meet your needs.

Event Names

Event Name Spring AI Requirement Comments
gen_ai.content.prompt 🔮 Optional Coming soon. Being implemented right now.
gen_ai.content.completion 🔮 Optional Coming soon. Being implemented right now.

Event Attributes

Event Attribute Type Spring AI Requirement Comments
gen_ai.prompt string 🔮 Conditionally Required if and only if corresponding event is enabled Coming soon. Being implemented right now. Currently, it's available as a span attribute.
gen_ai.completion string 🔮 Conditionally Required if and only if corresponding event is enabled Coming soon. Being implemented right now. Currently, it's available as a span attribute.

Metrics

Metric: Token Usage

Metric Name Type Unit Spring AI Requirement Comments
gen_ai.client.token.usage Histogram {token} 🔮 Recommended Coming soon. Being implemented right now. Currently, it's available, but not following the naming strategy.
Metric Attribute Type Spring AI Requirement Comments
gen_ai.operation.name string Required
gen_ai.request.model string Required
gen_ai.system string Required
gen_ai.token.type string Required
server.port int ⬇️ Conditionally Required If server.address is set. This attribute is optional. There isn't currently a plan to support it in Spring AI. You can find this information as part of the HTTP metrics auto-configured by Spring Boot. If you encounter a use-case in production where that is not enough, we would like to hear from you. Please, let us know by raising an issue and describing your scenario, so that we can get additional context and evaluate if and how to add this attribute to meet your needs.
gen_ai.response.model string Recommended
server.address string ⬇️ Recommended This attribute is optional. There isn't currently a plan to support it in Spring AI. You can find this information as part of the HTTP metrics auto-configured by Spring Boot. If you encounter a use-case in production where that is not enough, we would like to hear from you. Please, let us know by raising an issue and describing your scenario, so that we can get additional context and evaluate if and how to add this attribute to meet your needs.

Metric: Operation Duration

Metric Name Type Unit Spring AI Requirement Comments
gen_ai.client.operation.duration Histogram s 🔮 Recommended Coming soon. Being implemented right now. Currently, it's available, but not following the naming strategy.
Metric Attribute Type Spring AI Requirement Comments
gen_ai.operation.name string Required
gen_ai.request.model string Required
gen_ai.system string Required
error.type string ⬇️ Conditionally Required if the operation ended in an error. There isn't currently a plan to support it in Spring AI. You can find this information as part of the HTTP metrics auto-configured by Spring Boot. If you encounter a use-case in production where that is not enough, we would like to hear from you. Please, let us know by raising an issue and describing your scenario, so that we can get additional context and evaluate if and how to add this attribute to meet your needs.
server.port int ⬇️ Conditionally Required If server.address is set. This attribute is optional. There isn't currently a plan to support it in Spring AI. You can find this information as part of the HTTP metrics auto-configured by Spring Boot. If you encounter a use-case in production where that is not enough, we would like to hear from you. Please, let us know by raising an issue and describing your scenario, so that we can get additional context and evaluate if and how to add this attribute to meet your needs.
gen_ai.response.model string Recommended
server.address string ⬇️ Recommended This attribute is optional. There isn't currently a plan to support it in Spring AI. You can find this information as part of the HTTP metrics auto-configured by Spring Boot. If you encounter a use-case in production where that is not enough, we would like to hear from you. Please, let us know by raising an issue and describing your scenario, so that we can get additional context and evaluate if and how to add this attribute to meet your needs.

ThomasVitale avatar Aug 06 '24 13:08 ThomasVitale