pub struct CodebaseIndex {
pub repo_url: String,
pub repo_path: PathBuf,
pub metrics: Vec<MetricInstrumentation>,
pub alerts: Vec<AlertRule>,
pub last_updated: i64,
}Expand description
An index of all discovered metric instrumentation and alert rules in a codebase.
Fields§
§repo_url: StringThe git URL of the repository.
repo_path: PathBufThe local path to the repository.
metrics: Vec<MetricInstrumentation>All discovered metric instrumentation points.
alerts: Vec<AlertRule>All discovered Prometheus alert rules.
last_updated: i64Unix timestamp when this index was built.
Implementations§
Source§impl CodebaseIndex
impl CodebaseIndex
Sourcepub fn unique_metric_count(&self) -> usize
pub fn unique_metric_count(&self) -> usize
Returns the number of unique metric names.
Sourcepub fn files_with_metrics(&self) -> usize
pub fn files_with_metrics(&self) -> usize
Returns the number of files containing metrics.
Sourcepub fn search(&self, query: &str) -> Vec<&MetricInstrumentation>
pub fn search(&self, query: &str) -> Vec<&MetricInstrumentation>
Searches for metrics matching the given query.
Sourcepub fn find_by_name(&self, name: &str) -> Vec<&MetricInstrumentation>
pub fn find_by_name(&self, name: &str) -> Vec<&MetricInstrumentation>
Finds all instrumentation points for a specific metric name.
First tries exact matching. If no matches found, falls back to suffix
matching to handle runtime prefixes (e.g., app_http_requests_total
matches http_requests_total in source code).
Sourcepub fn alert_count(&self) -> usize
pub fn alert_count(&self) -> usize
Returns the number of alert rules.
Sourcepub fn find_alerts_by_metric(&self, metric_name: &str) -> Vec<&AlertRule>
pub fn find_alerts_by_metric(&self, metric_name: &str) -> Vec<&AlertRule>
Finds all alert rules that reference a specific metric name.
Sourcepub fn find_alert_by_name(&self, alert_name: &str) -> Option<&AlertRule>
pub fn find_alert_by_name(&self, alert_name: &str) -> Option<&AlertRule>
Finds an alert rule by its name.
Sourcepub fn search_alerts(&self, query: &str) -> Vec<&AlertRule>
pub fn search_alerts(&self, query: &str) -> Vec<&AlertRule>
Searches for alert rules matching the given query.
Trait Implementations§
Source§impl Clone for CodebaseIndex
impl Clone for CodebaseIndex
Source§fn clone(&self) -> CodebaseIndex
fn clone(&self) -> CodebaseIndex
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CodebaseIndex
impl RefUnwindSafe for CodebaseIndex
impl Send for CodebaseIndex
impl Sync for CodebaseIndex
impl Unpin for CodebaseIndex
impl UnsafeUnpin for CodebaseIndex
impl UnwindSafe for CodebaseIndex
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more