-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: indexer_error metrics moved to indexer_common, auto inc and…
… logs in new fn
- Loading branch information
Showing
11 changed files
with
118 additions
and
81 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2023-, GraphOps and Semiotic Labs. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use once_cell::sync::Lazy; | ||
use prometheus::{core::Collector, register, IntCounterVec, Opts, Registry}; | ||
|
||
#[allow(dead_code)] | ||
pub static INDEXER_ERROR: Lazy<IntCounterVec> = Lazy::new(|| { | ||
let m = IntCounterVec::new( | ||
Opts::new("indexer_error", "Indexer errors observed over time") | ||
.namespace("indexer") | ||
.subsystem("service"), | ||
&["code"], | ||
) | ||
.expect("Failed to create indexer_error"); | ||
register(Box::new(m.clone())).expect("Failed to register indexer_error counter"); | ||
m | ||
}); | ||
|
||
#[allow(dead_code)] | ||
pub static REGISTRY: Lazy<Registry> = Lazy::new(Registry::new); | ||
|
||
#[allow(dead_code)] | ||
pub fn register_metrics(registry: &Registry, metrics: Vec<Box<dyn Collector>>) { | ||
for metric in metrics { | ||
registry.register(metric).expect("Cannot register metrics"); | ||
} | ||
} | ||
|
||
/// Register indexer error metrics in Prometheus registry | ||
pub fn register_indexer_error_metrics() { | ||
register_metrics(®ISTRY, vec![Box::new(INDEXER_ERROR.clone())]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters