pub struct PrometheusResource {
pub url: String,
pub query_endpoint: String,
pub ingestion_endpoint: String,
}Expand description
Resource for querying Prometheus metrics
Fields§
§url: StringBase URL for Prometheus (e.g., http://localhost:30090)
query_endpoint: StringQuery endpoint (e.g., http://localhost:30090/api/v1/query)
ingestion_endpoint: StringMetrics ingestion endpoint for OTLP (e.g., http://localhost:30090/api/v1/otlp/v1/metrics)
Implementations§
Source§impl PrometheusResource
impl PrometheusResource
Sourcepub async fn query(&self, query: &str) -> Result<Option<f64>>
pub async fn query(&self, query: &str) -> Result<Option<f64>>
Query Prometheus for a metric value
Sourcepub async fn query_count(&self, query: &str) -> Result<Option<u64>>
pub async fn query_count(&self, query: &str) -> Result<Option<u64>>
Query for a metric and return as u64
Sourcepub fn output_rows_query(node_id: &str, instance_id: Option<&str>) -> String
pub fn output_rows_query(node_id: &str, instance_id: Option<&str>) -> String
Build a query for output rows total metric
Sourcepub fn input_rows_query(node_id: &str, instance_id: Option<&str>) -> String
pub fn input_rows_query(node_id: &str, instance_id: Option<&str>) -> String
Build a query for input rows total metric
Sourcepub fn elapsed_compute_query(node_id: &str, instance_id: Option<&str>) -> String
pub fn elapsed_compute_query(node_id: &str, instance_id: Option<&str>) -> String
Build a query for elapsed compute metric
Sourcepub fn checkpoint_coordinator_query(
metric_name: &str,
instance_id: Option<&str>,
) -> String
pub fn checkpoint_coordinator_query( metric_name: &str, instance_id: Option<&str>, ) -> String
Build a query for a checkpoint coordinator metric (counter total).
Coordinator metrics use id="checkpoint_coordinator".
Sourcepub fn checkpoint_histogram_query(
metric_name: &str,
node_id: &str,
instance_id: Option<&str>,
) -> String
pub fn checkpoint_histogram_query( metric_name: &str, node_id: &str, instance_id: Option<&str>, ) -> String
Build a query for a checkpoint histogram metric (sum) by node id.
Auto Trait Implementations§
impl Freeze for PrometheusResource
impl RefUnwindSafe for PrometheusResource
impl Send for PrometheusResource
impl Sync for PrometheusResource
impl Unpin for PrometheusResource
impl UnsafeUnpin for PrometheusResource
impl UnwindSafe for PrometheusResource
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 moreCreates a shared type from an unshared type.