pub struct SpanValidator { /* private fields */ }Expand description
Span validator for OTEL self-testing
Implementations§
Source§impl SpanValidator
impl SpanValidator
Sourcepub fn from_span_data(spans: &[SpanData]) -> Result<Self>
pub fn from_span_data(spans: &[SpanData]) -> Result<Self>
Sourcepub fn find_spans_by_name(&self, name: &str) -> Vec<&SpanData>
pub fn find_spans_by_name(&self, name: &str) -> Vec<&SpanData>
Find spans by name
Sourcepub fn find_span(&self, trace_id: &str, span_id: &str) -> Option<&SpanData>
pub fn find_span(&self, trace_id: &str, span_id: &str) -> Option<&SpanData>
Find span by exact trace ID and span ID
Sourcepub fn count_spans(&self, name: &str) -> usize
pub fn count_spans(&self, name: &str) -> usize
Count spans with given name
Sourcepub fn validate_expectations(
&self,
expectations: &[SpanExpectationConfig],
) -> Result<ValidationResult>
pub fn validate_expectations( &self, expectations: &[SpanExpectationConfig], ) -> Result<ValidationResult>
Validate spans against PRD-style expectations with detailed error tracking
This is the primary validation method that processes SpanExpectationConfig from TOML and returns structured validation results.
§Arguments
expectations- List of span expectations from TOML[[expect.span]]blocks
§Returns
Result<ValidationResult>- Detailed validation results with failure tracking
Sourcepub fn first_failure(result: &ValidationResult) -> Option<&FailureDetails>
pub fn first_failure(result: &ValidationResult) -> Option<&FailureDetails>
Get the first failure from validation results (for error reporting)
Sourcepub fn validate_assertion(&self, assertion: &SpanAssertion) -> Result<()>
pub fn validate_assertion(&self, assertion: &SpanAssertion) -> Result<()>
Validate a single assertion
Sourcepub fn validate_assertions(&self, assertions: &[SpanAssertion]) -> Result<()>
pub fn validate_assertions(&self, assertions: &[SpanAssertion]) -> Result<()>
Validate multiple assertions
Sourcepub fn get_span(&self, name: &str) -> Option<&SpanData>
pub fn get_span(&self, name: &str) -> Option<&SpanData>
Get a span by name (returns first match)
Sourcepub fn get_span_by_id(&self, span_id: &str) -> Option<&SpanData>
pub fn get_span_by_id(&self, span_id: &str) -> Option<&SpanData>
Get a span by span_id
Auto Trait Implementations§
impl Freeze for SpanValidator
impl RefUnwindSafe for SpanValidator
impl Send for SpanValidator
impl Sync for SpanValidator
impl Unpin for SpanValidator
impl UnwindSafe for SpanValidator
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
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
Converts
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>
Converts
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request