pub struct OperationalMetrics {
pub queries_total: AtomicU64,
pub query_errors: AtomicU64,
pub query_rate_limited: AtomicU64,
pub vector_queries: AtomicU64,
pub graph_queries: AtomicU64,
pub hybrid_queries: AtomicU64,
pub documents_total: AtomicU64,
pub index_size_bytes: AtomicU64,
pub active_connections: AtomicU64,
}Expand description
Operational metrics for VelesDB monitoring (EPIC-050 US-001).
Thread-safe counters and gauges that can be exported in Prometheus format.
Fields§
§queries_total: AtomicU64Total queries executed
query_errors: AtomicU64Total query errors
query_rate_limited: AtomicU64Queries rejected by guard rails (rate limiting, circuit breaker)
vector_queries: AtomicU64Vector search queries
graph_queries: AtomicU64Graph traversal queries
hybrid_queries: AtomicU64Hybrid queries (vector + graph)
documents_total: AtomicU64Total documents across all collections
index_size_bytes: AtomicU64Total index size in bytes
active_connections: AtomicU64Active connections (for server)
Implementations§
Source§impl OperationalMetrics
impl OperationalMetrics
Sourcepub fn new_arc() -> Arc<Self> ⓘ
pub fn new_arc() -> Arc<Self> ⓘ
Creates a fresh metrics instance wrapped in an Arc for shared
ownership across handlers.
This is a constructor convenience — every call returns a brand-new
counter set. Callers that want a single workspace-wide instance
must hold the returned Arc themselves (e.g. in AppState) and
clone it where needed; this method does NOT back the instance with
a global cache.
👎Deprecated since 1.13.2: use OperationalMetrics::new_arc instead
use OperationalMetrics::new_arc instead
Deprecated alias of OperationalMetrics::new_arc.
The original name implied a global singleton, but the
implementation always returned a fresh Arc::new(Self::new()).
Kept as a forwarding alias to preserve the v1.13.1 public API
surface; callers should migrate to new_arc.
Sourcepub fn inc_queries(&self)
pub fn inc_queries(&self)
Increments the total query counter.
Sourcepub fn inc_errors(&self)
pub fn inc_errors(&self)
Increments the query error counter.
Sourcepub fn inc_rate_limited(&self)
pub fn inc_rate_limited(&self)
Increments the rate-limited/rejected counter.
Sourcepub fn record_vector_query(&self)
pub fn record_vector_query(&self)
Records a vector search query.
Sourcepub fn record_graph_query(&self)
pub fn record_graph_query(&self)
Records a graph traversal query.
Sourcepub fn record_hybrid_query(&self)
pub fn record_hybrid_query(&self)
Records a hybrid query.
Sourcepub fn set_documents(&self, count: u64)
pub fn set_documents(&self, count: u64)
Sets the document count.
Sourcepub fn set_index_size(&self, bytes: u64)
pub fn set_index_size(&self, bytes: u64)
Sets the index size.
Sourcepub fn inc_connections(&self)
pub fn inc_connections(&self)
Increments active connections.
Sourcepub fn dec_connections(&self)
pub fn dec_connections(&self)
Decrements active connections.
Uses fetch_update to saturate at 0, preventing underflow wrap to u64::MAX.
Sourcepub fn export_prometheus(&self) -> String
pub fn export_prometheus(&self) -> String
Exports metrics in Prometheus text format.
Trait Implementations§
Source§impl Debug for OperationalMetrics
impl Debug for OperationalMetrics
Source§impl Default for OperationalMetrics
impl Default for OperationalMetrics
Source§fn default() -> OperationalMetrics
fn default() -> OperationalMetrics
Auto Trait Implementations§
impl !Freeze for OperationalMetrics
impl RefUnwindSafe for OperationalMetrics
impl Send for OperationalMetrics
impl Sync for OperationalMetrics
impl Unpin for OperationalMetrics
impl UnsafeUnpin for OperationalMetrics
impl UnwindSafe for OperationalMetrics
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> 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>
renamed to 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);