pub struct GraphQLMetrics { /* private fields */ }Expand description
GraphQL metrics collector
Implementations§
Source§impl GraphQLMetrics
impl GraphQLMetrics
Sourcepub fn record_query(&self, duration: Duration, operation_type: OperationType)
pub fn record_query(&self, duration: Duration, operation_type: OperationType)
Record a query execution
Sourcepub fn record_operation(
&self,
name: &str,
duration: Duration,
operation_type: OperationType,
)
pub fn record_operation( &self, name: &str, duration: Duration, operation_type: OperationType, )
Record a named operation
Sourcepub fn record_error(&self, error: &GraphQLError)
pub fn record_error(&self, error: &GraphQLError)
Record an error
Sourcepub fn query_stats(&self) -> &QueryStats
pub fn query_stats(&self) -> &QueryStats
Get query statistics
Sourcepub fn operation_metrics(&self, name: &str) -> Option<OperationMetrics>
pub fn operation_metrics(&self, name: &str) -> Option<OperationMetrics>
Get operation metrics
Sourcepub fn all_operations(&self) -> HashMap<String, OperationMetrics>
pub fn all_operations(&self) -> HashMap<String, OperationMetrics>
Get all operation metrics
Sourcepub fn error_counts(&self) -> HashMap<ErrorCode, u64>
pub fn error_counts(&self) -> HashMap<ErrorCode, u64>
Get error counts
Sourcepub fn to_prometheus(&self) -> String
pub fn to_prometheus(&self) -> String
Export metrics in Prometheus format
Trait Implementations§
Source§impl Debug for GraphQLMetrics
impl Debug for GraphQLMetrics
Auto Trait Implementations§
impl !Freeze for GraphQLMetrics
impl RefUnwindSafe for GraphQLMetrics
impl Send for GraphQLMetrics
impl Sync for GraphQLMetrics
impl Unpin for GraphQLMetrics
impl UnsafeUnpin for GraphQLMetrics
impl UnwindSafe for GraphQLMetrics
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> 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 more