The first and most important attribute to set is the SpanKind. This will not be automatically set for you if you are using manual tracing. Setting this will enable certain types of fields to appear as well as help you organize your traces to look like your code structure.
from openinference.semconv.trace import ( OpenInferenceSpanKindValues, SpanAttributes,)# Agent Span# Use this to wrap agentic flows that may involve multiple LLM and/or tool callsspan.set_attribute( SpanAttributes.OPENINFERENCE_SPAN_KIND, OpenInferenceSpanKindValues.AGENT.value)# LLM Span# Use this to wrap the LLM callspan.set_attribute( SpanAttributes.OPENINFERENCE_SPAN_KIND, OpenInferenceSpanKindValues.LLM.value,)# Tool Span# Use this to wrap any tool callsspan.set_attribute( SpanAttributes.OPENINFERENCE_SPAN_KIND, OpenInferenceSpanKindValues.TOOL.value,)# Chain span# Use this to wrap any preparation step where a prompt template # is combined with prompt variables before being sent to an LLMspan.set_attribute( SpanAttributes.OPENINFERENCE_SPAN_KIND, OpenInferenceSpanKindValues.CHAIN.value,)# Chain span# Use this to wrap any preparation step where a prompt template # is combined with prompt variables before being sent to an LLMspan.set_attribute( SpanAttributes.OPENINFERENCE_SPAN_KIND, OpenInferenceSpanKindValues.CHAIN.value,)# Retriever span# Use this to wrap any step that retrieves documents before sending it to the LLM span.set_attribute( SpanAttributes.OPENINFERENCE_SPAN_KIND, OpenInferenceSpanKindValues.RETRIEVER.value,)# Embedding span# Use this to wrap the embedding step used by the retrieverspan.set_attribute( SpanAttributes.OPENINFERENCE_SPAN_KIND, OpenInferenceSpanKindValues.EMBEDDING.value,)# Reranker span# Use this to wrap any reranker step used after the retrieverspan.set_attribute( SpanAttributes.OPENINFERENCE_SPAN_KIND, OpenInferenceSpanKindValues.RERANKER.value,)