-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Improve observability by addind a few additional metrics, expo…
…se the binary build info
- Loading branch information
Showing
6 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
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,2 @@ | ||
[env] | ||
NEARCORE_VERSION = "1.37.1" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,10 @@ version = "0.1.29" | |
authors = ["Near Inc <[email protected]>"] | ||
edition = "2021" | ||
|
||
[build-dependencies] | ||
anyhow = "1.0.51" | ||
rustc_version = "0.4" | ||
|
||
[dependencies] | ||
actix = "0.13.0" | ||
anyhow = "1.0.51" | ||
|
@@ -18,13 +22,15 @@ http = "0.2" | |
humantime = "2.1.0" | ||
itertools = "0.10.0" | ||
openssl-probe = "0.1.5" | ||
once_cell = "1.19.0" | ||
serde = { version = "1", features = ["derive"] } | ||
serde_json = "1.0.55" | ||
tokio = { version = "1.1", features = ["sync", "time"] } | ||
tokio-stream = { version = "0.1" } | ||
tracing = "0.1.34" | ||
tracing-subscriber = "0.2.4" | ||
|
||
# Please, update the supported nearcore version in .cargo/config.toml file | ||
near-indexer = { git = "https://github.com/near/nearcore", rev = "0f8e073b0be5c2df4d9382bd359edb4d1f88b632" } | ||
near-indexer-primitives = { git = "https://github.com/near/nearcore", rev = "0f8e073b0be5c2df4d9382bd359edb4d1f88b632" } | ||
near-client = { git = "https://github.com/near/nearcore", rev = "0f8e073b0be5c2df4d9382bd359edb4d1f88b632" } | ||
|
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,20 @@ | ||
/// This build.rs script is used to generate build-time information and set environment variables for the build process. | ||
/// It retrieves the Rust compiler version and sets it as the `RUSTC_VERSION` environment variable. | ||
/// It also sets the `BUILD_VERSION` environment variable to the value of `NEARCORE_VERSION` defined in the project. | ||
/// Additionally, it prints messages to indicate which files should trigger a rebuild when changed. | ||
fn get_rustc_version() -> anyhow::Result<String> { | ||
let version = rustc_version::version()?; | ||
Ok(version.to_string()) | ||
} | ||
|
||
fn main() -> anyhow::Result<()> { | ||
println!("cargo:rerun-if-changed=.git/HEAD"); | ||
println!("cargo:rerun-if-changed=.git/index"); | ||
|
||
println!("cargo:rustc-env=BUILD_VERSION={}", env!("NEARCORE_VERSION")); | ||
|
||
let rustc_version = get_rustc_version()?; | ||
println!("cargo:rustc-env=RUSTC_VERSION={}", rustc_version); | ||
|
||
Ok(()) | ||
} |
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,30 @@ | ||
use near_o11y::metrics::*; | ||
use once_cell::sync::Lazy; | ||
|
||
pub static BLOCKS_DONE: Lazy<IntCounter> = Lazy::new(|| { | ||
try_create_int_counter( | ||
"near_lake_block_done_total", | ||
"Total number of indexed blocks", | ||
) | ||
.unwrap() | ||
}); | ||
|
||
pub static RETRY_COUNT: Lazy<IntCounter> = Lazy::new(|| { | ||
try_create_int_counter( | ||
"near_lake_block_retry_count_total", | ||
"Total number of retries for storing indexing blocks to S3", | ||
) | ||
.unwrap() | ||
}); | ||
|
||
// This metric is present in the near_o11y crate but it's not public | ||
// so we can't use it directly. We have to redefine it here. | ||
pub static NODE_BUILD_INFO: Lazy<IntCounterVec> = Lazy::new(|| { | ||
try_create_int_counter_vec( | ||
"near_lake_build_info", | ||
"Metric whose labels indicate node’s version; see \ | ||
<https://www.robustperception.io/exposing-the-software-version-to-prometheus>.", | ||
&["release", "build", "rustc_version"], | ||
) | ||
.unwrap() | ||
}); |