PrometheusMetrics

Struct PrometheusMetrics 

Source
pub struct PrometheusMetrics {
Show 28 fields pub nodes_created: IntCounter, pub edges_created: IntCounter, pub prompts_submitted: IntCounter, pub responses_generated: IntCounter, pub tools_invoked: IntCounter, pub agent_handoffs: IntCounter, pub template_instantiations: IntCounter, pub queries_executed: IntCounter, pub write_latency: Histogram, pub read_latency: Histogram, pub query_duration: Histogram, pub tool_duration: Histogram, pub batch_size: Histogram, pub active_sessions: IntGauge, pub total_nodes: IntGauge, pub total_edges: IntGauge, pub cache_size_bytes: IntGauge, pub buffer_size: IntGauge, pub grpc_requests_total: IntCounterVec, pub grpc_request_duration: HistogramVec, pub grpc_active_streams: IntGauge, pub plugin_executions_total: IntCounterVec, pub plugin_duration: HistogramVec, pub plugin_errors_total: IntCounterVec, pub registry_calls_total: IntCounterVec, pub vault_archives_total: IntCounter, pub vault_retrievals_total: IntCounter, pub vault_errors_total: IntCounter,
}
Expand description

Prometheus metrics for MemoryGraph monitoring

Provides comprehensive production-grade metrics across multiple categories:

  • 8 Counters for tracking operations
  • 5 Histograms for latency and size distributions
  • 5 Gauges for current state monitoring
  • 7 Production metrics (gRPC, Plugin, Integration)

Fields§

§nodes_created: IntCounter

Total number of nodes created

§edges_created: IntCounter

Total number of edges created

§prompts_submitted: IntCounter

Total number of prompts submitted

§responses_generated: IntCounter

Total number of responses generated

§tools_invoked: IntCounter

Total number of tools invoked

§agent_handoffs: IntCounter

Total number of agent handoffs

§template_instantiations: IntCounter

Total number of template instantiations

§queries_executed: IntCounter

Total number of queries executed

§write_latency: Histogram

Write operation latency distribution (seconds)

§read_latency: Histogram

Read operation latency distribution (seconds)

§query_duration: Histogram

Query execution duration distribution (seconds)

§tool_duration: Histogram

Tool execution duration distribution (seconds)

§batch_size: Histogram

Batch operation size distribution

§active_sessions: IntGauge

Number of currently active sessions

§total_nodes: IntGauge

Total number of nodes in the graph

§total_edges: IntGauge

Total number of edges in the graph

§cache_size_bytes: IntGauge

Current cache size in bytes

§buffer_size: IntGauge

Current event buffer size

§grpc_requests_total: IntCounterVec

Total gRPC requests by method and status

§grpc_request_duration: HistogramVec

gRPC request duration by method

§grpc_active_streams: IntGauge

Number of active gRPC streams

§plugin_executions_total: IntCounterVec

Total plugin executions by plugin name and hook

§plugin_duration: HistogramVec

Plugin execution duration by plugin and hook

§plugin_errors_total: IntCounterVec

Total plugin errors by plugin and error type

§registry_calls_total: IntCounterVec

Total LLM-Registry API calls by operation and status

§vault_archives_total: IntCounter

Total sessions archived to Data-Vault

§vault_retrievals_total: IntCounter

Total sessions retrieved from Data-Vault

§vault_errors_total: IntCounter

Total Data-Vault errors

Implementations§

Source§

impl PrometheusMetrics

Source

pub fn new(registry: &Registry) -> Result<Self>

Create and register all metrics with the provided registry

§Arguments
  • registry - Prometheus registry to register metrics with
§Returns

Returns a new PrometheusMetrics instance with all metrics registered

§Errors

Returns an error if metric registration fails

Source

pub fn with_namespace(registry: &Registry, _namespace: &str) -> Result<Self>

Create metrics with a custom namespace prefix

Source

pub fn record_node_created(&self)

Record a node creation

Source

pub fn record_nodes_created(&self, count: u64)

Record multiple node creations

Source

pub fn record_edge_created(&self)

Record an edge creation

Source

pub fn record_edges_created(&self, count: u64)

Record multiple edge creations

Source

pub fn record_prompt_submitted(&self)

Record a prompt submission

Source

pub fn record_response_generated(&self)

Record a response generation

Source

pub fn record_tool_invoked(&self)

Record a tool invocation

Source

pub fn record_agent_handoff(&self)

Record an agent handoff

Source

pub fn record_template_instantiation(&self)

Record a template instantiation

Source

pub fn record_query_executed(&self)

Record a query execution

Source

pub fn record_write_latency(&self, duration_secs: f64)

Record write operation latency in seconds

Source

pub fn record_read_latency(&self, duration_secs: f64)

Record read operation latency in seconds

Source

pub fn record_query_duration(&self, duration_secs: f64)

Record query execution duration in seconds

Source

pub fn record_tool_duration(&self, duration_secs: f64)

Record tool execution duration in seconds

Source

pub fn record_batch_size(&self, size: usize)

Record batch operation size

Source

pub fn set_active_sessions(&self, count: i64)

Set the number of active sessions

Source

pub fn inc_active_sessions(&self)

Increment active sessions count

Source

pub fn dec_active_sessions(&self)

Decrement active sessions count

Source

pub fn set_total_nodes(&self, count: i64)

Set the total number of nodes

Source

pub fn inc_total_nodes(&self)

Increment total nodes count

Source

pub fn inc_total_nodes_by(&self, count: i64)

Increment total nodes by amount

Source

pub fn set_total_edges(&self, count: i64)

Set the total number of edges

Source

pub fn inc_total_edges(&self)

Increment total edges count

Source

pub fn inc_total_edges_by(&self, count: i64)

Increment total edges by amount

Source

pub fn set_cache_size_bytes(&self, size: i64)

Set cache size in bytes

Source

pub fn set_buffer_size(&self, size: i64)

Set event buffer size

Source

pub fn record_grpc_request(&self, method: &str, status: &str)

Record a gRPC request with method and status

Source

pub fn record_grpc_request_duration(&self, method: &str, duration_secs: f64)

Record gRPC request duration for a method

Source

pub fn inc_grpc_active_streams(&self)

Increment active gRPC streams count

Source

pub fn dec_grpc_active_streams(&self)

Decrement active gRPC streams count

Source

pub fn set_grpc_active_streams(&self, count: i64)

Set the number of active gRPC streams

Source

pub fn record_plugin_execution(&self, plugin: &str, hook: &str)

Record a plugin execution

Source

pub fn record_plugin_duration( &self, plugin: &str, hook: &str, duration_secs: f64, )

Record plugin execution duration

Source

pub fn record_plugin_error(&self, plugin: &str, error_type: &str)

Record a plugin error

Source

pub fn record_registry_call(&self, operation: &str, status: &str)

Record an LLM-Registry API call

Source

pub fn record_vault_archive(&self)

Record a successful vault archive operation

Source

pub fn record_vault_archives(&self, count: u64)

Record multiple vault archive operations

Source

pub fn record_vault_retrieval(&self)

Record a successful vault retrieval operation

Source

pub fn record_vault_retrievals(&self, count: u64)

Record multiple vault retrieval operations

Source

pub fn record_vault_error(&self)

Record a vault error

Source

pub fn record_vault_errors(&self, count: u64)

Record multiple vault errors

Source

pub fn get_counter_snapshot(&self) -> MetricsCounterSnapshot

Get a snapshot of all counter values

Source

pub fn get_gauge_snapshot(&self) -> MetricsGaugeSnapshot

Get a snapshot of all gauge values

Source

pub fn get_grpc_snapshot(&self) -> GrpcMetricsSnapshot

Get a snapshot of gRPC metrics

Source

pub fn get_vault_snapshot(&self) -> VaultMetricsSnapshot

Get a snapshot of vault metrics

Trait Implementations§

Source§

impl Clone for PrometheusMetrics

Source§

fn clone(&self) -> PrometheusMetrics

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more