#[non_exhaustive]pub struct SpanAttributes {Show 34 fields
pub operation_name: Option<String>,
pub provider_name: Option<String>,
pub error_type: Option<String>,
pub agent_id: Option<String>,
pub instance_arn: Option<String>,
pub contact_id: Option<String>,
pub initial_contact_id: Option<String>,
pub session_name: Option<String>,
pub ai_agent_arn: Option<String>,
pub ai_agent_type: Option<AiAgentType>,
pub ai_agent_name: Option<String>,
pub ai_agent_id: Option<String>,
pub ai_agent_version: Option<i32>,
pub ai_agent_invoker: Option<String>,
pub ai_agent_orchestrator_use_case: Option<String>,
pub request_model: Option<String>,
pub request_max_tokens: Option<i32>,
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub response_model: Option<String>,
pub response_finish_reasons: Option<Vec<String>>,
pub usage_input_tokens: Option<i32>,
pub usage_output_tokens: Option<i32>,
pub usage_total_tokens: Option<i32>,
pub cache_read_input_tokens: Option<i32>,
pub cache_write_input_tokens: Option<i32>,
pub input_messages: Option<Vec<SpanMessage>>,
pub output_messages: Option<Vec<SpanMessage>>,
pub system_instructions: Option<Vec<SpanMessageValue>>,
pub prompt_arn: Option<String>,
pub prompt_id: Option<String>,
pub prompt_type: Option<AiPromptType>,
pub prompt_name: Option<String>,
pub prompt_version: Option<i32>,
}Expand description
Contextual attributes capturing operation details, LLM configuration, usage metrics, and conversation data
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.operation_name: Option<String>Action being performed
provider_name: Option<String>Model provider identifier (e.g., aws.bedrock)
error_type: Option<String>Error classification if span failed (e.g., throttle, timeout)
agent_id: Option<String>Amazon Connect agent ID
instance_arn: Option<String>Amazon Connect instance ARN
contact_id: Option<String>Amazon Connect contact identifier
initial_contact_id: Option<String>Amazon Connect contact identifier
session_name: Option<String>Session name
ai_agent_arn: Option<String>AI agent ARN
ai_agent_type: Option<AiAgentType>AI agent type
ai_agent_name: Option<String>AI agent name
ai_agent_id: Option<String>AI agent identifier
ai_agent_version: Option<i32>AI agent version number
ai_agent_invoker: Option<String>Entity that invoked the AI agent
ai_agent_orchestrator_use_case: Option<String>AI agent orchestrator use case
request_model: Option<String>LLM model ID for request (e.g., anthropic.claude-3-sonnet)
request_max_tokens: Option<i32>Maximum tokens configured for generation
temperature: Option<f32>Sampling temperature for generation
top_p: Option<f32>Top-p sampling parameter for generation
response_model: Option<String>Actual model used for response (usually matches requestModel)
response_finish_reasons: Option<Vec<String>>Generation termination reasons (e.g., stop, max_tokens)
usage_input_tokens: Option<i32>Number of input tokens in prompt
usage_output_tokens: Option<i32>Number of output tokens in response
usage_total_tokens: Option<i32>Total tokens consumed (input + output)
cache_read_input_tokens: Option<i32>Number of input tokens that were retrieved from cache
cache_write_input_tokens: Option<i32>Number of input tokens that were written to cache in this request
input_messages: Option<Vec<SpanMessage>>Input message collection sent to LLM
output_messages: Option<Vec<SpanMessage>>Output message collection received from LLM
system_instructions: Option<Vec<SpanMessageValue>>System prompt instructions
prompt_arn: Option<String>AI prompt ARN
prompt_id: Option<String>AI prompt identifier
prompt_type: Option<AiPromptType>AI prompt type
prompt_name: Option<String>AI prompt name
prompt_version: Option<i32>AI prompt version number
Implementations§
Source§impl SpanAttributes
impl SpanAttributes
Sourcepub fn operation_name(&self) -> Option<&str>
pub fn operation_name(&self) -> Option<&str>
Action being performed
Sourcepub fn provider_name(&self) -> Option<&str>
pub fn provider_name(&self) -> Option<&str>
Model provider identifier (e.g., aws.bedrock)
Sourcepub fn error_type(&self) -> Option<&str>
pub fn error_type(&self) -> Option<&str>
Error classification if span failed (e.g., throttle, timeout)
Sourcepub fn instance_arn(&self) -> Option<&str>
pub fn instance_arn(&self) -> Option<&str>
Amazon Connect instance ARN
Sourcepub fn contact_id(&self) -> Option<&str>
pub fn contact_id(&self) -> Option<&str>
Amazon Connect contact identifier
Sourcepub fn initial_contact_id(&self) -> Option<&str>
pub fn initial_contact_id(&self) -> Option<&str>
Amazon Connect contact identifier
Sourcepub fn session_name(&self) -> Option<&str>
pub fn session_name(&self) -> Option<&str>
Session name
Sourcepub fn ai_agent_arn(&self) -> Option<&str>
pub fn ai_agent_arn(&self) -> Option<&str>
AI agent ARN
Sourcepub fn ai_agent_type(&self) -> Option<&AiAgentType>
pub fn ai_agent_type(&self) -> Option<&AiAgentType>
AI agent type
Sourcepub fn ai_agent_name(&self) -> Option<&str>
pub fn ai_agent_name(&self) -> Option<&str>
AI agent name
Sourcepub fn ai_agent_id(&self) -> Option<&str>
pub fn ai_agent_id(&self) -> Option<&str>
AI agent identifier
Sourcepub fn ai_agent_version(&self) -> Option<i32>
pub fn ai_agent_version(&self) -> Option<i32>
AI agent version number
Sourcepub fn ai_agent_invoker(&self) -> Option<&str>
pub fn ai_agent_invoker(&self) -> Option<&str>
Entity that invoked the AI agent
Sourcepub fn ai_agent_orchestrator_use_case(&self) -> Option<&str>
pub fn ai_agent_orchestrator_use_case(&self) -> Option<&str>
AI agent orchestrator use case
Sourcepub fn request_model(&self) -> Option<&str>
pub fn request_model(&self) -> Option<&str>
LLM model ID for request (e.g., anthropic.claude-3-sonnet)
Sourcepub fn request_max_tokens(&self) -> Option<i32>
pub fn request_max_tokens(&self) -> Option<i32>
Maximum tokens configured for generation
Sourcepub fn temperature(&self) -> Option<f32>
pub fn temperature(&self) -> Option<f32>
Sampling temperature for generation
Sourcepub fn response_model(&self) -> Option<&str>
pub fn response_model(&self) -> Option<&str>
Actual model used for response (usually matches requestModel)
Sourcepub fn response_finish_reasons(&self) -> &[String]
pub fn response_finish_reasons(&self) -> &[String]
Generation termination reasons (e.g., stop, max_tokens)
If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use .response_finish_reasons.is_none().
Sourcepub fn usage_input_tokens(&self) -> Option<i32>
pub fn usage_input_tokens(&self) -> Option<i32>
Number of input tokens in prompt
Sourcepub fn usage_output_tokens(&self) -> Option<i32>
pub fn usage_output_tokens(&self) -> Option<i32>
Number of output tokens in response
Sourcepub fn usage_total_tokens(&self) -> Option<i32>
pub fn usage_total_tokens(&self) -> Option<i32>
Total tokens consumed (input + output)
Sourcepub fn cache_read_input_tokens(&self) -> Option<i32>
pub fn cache_read_input_tokens(&self) -> Option<i32>
Number of input tokens that were retrieved from cache
Sourcepub fn cache_write_input_tokens(&self) -> Option<i32>
pub fn cache_write_input_tokens(&self) -> Option<i32>
Number of input tokens that were written to cache in this request
Sourcepub fn input_messages(&self) -> &[SpanMessage]
pub fn input_messages(&self) -> &[SpanMessage]
Input message collection sent to LLM
If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use .input_messages.is_none().
Sourcepub fn output_messages(&self) -> &[SpanMessage]
pub fn output_messages(&self) -> &[SpanMessage]
Output message collection received from LLM
If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use .output_messages.is_none().
Sourcepub fn system_instructions(&self) -> &[SpanMessageValue]
pub fn system_instructions(&self) -> &[SpanMessageValue]
System prompt instructions
If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use .system_instructions.is_none().
Sourcepub fn prompt_arn(&self) -> Option<&str>
pub fn prompt_arn(&self) -> Option<&str>
AI prompt ARN
Sourcepub fn prompt_type(&self) -> Option<&AiPromptType>
pub fn prompt_type(&self) -> Option<&AiPromptType>
AI prompt type
Sourcepub fn prompt_name(&self) -> Option<&str>
pub fn prompt_name(&self) -> Option<&str>
AI prompt name
Sourcepub fn prompt_version(&self) -> Option<i32>
pub fn prompt_version(&self) -> Option<i32>
AI prompt version number
Source§impl SpanAttributes
impl SpanAttributes
Sourcepub fn builder() -> SpanAttributesBuilder
pub fn builder() -> SpanAttributesBuilder
Creates a new builder-style object to manufacture SpanAttributes.
Trait Implementations§
Source§impl Clone for SpanAttributes
impl Clone for SpanAttributes
Source§fn clone(&self) -> SpanAttributes
fn clone(&self) -> SpanAttributes
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SpanAttributes
impl Debug for SpanAttributes
Source§impl PartialEq for SpanAttributes
impl PartialEq for SpanAttributes
impl StructuralPartialEq for SpanAttributes
Auto Trait Implementations§
impl Freeze for SpanAttributes
impl RefUnwindSafe for SpanAttributes
impl Send for SpanAttributes
impl Sync for SpanAttributes
impl Unpin for SpanAttributes
impl UnwindSafe for SpanAttributes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);