-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(node): Move some stuff around (#2151)
## What ❔ Moves some easily movable stuff from `zksync_external_node` binary, e.g. - rustc metrics - main node healthcheck - validate chain ids task Note: this PR does not aim to be exhaustive. There will be more PRs like this in the future. ## Why ❔ - Makes logic shareable (e.g. we can now use rustc metrics for main node too) - Less logic in binary makes it easier to switch to the framework. ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zk fmt` and `zk lint`. - [ ] Spellcheck has been run via `zk spellcheck`.
- Loading branch information
Showing
13 changed files
with
86 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,3 @@ | ||
//! Metadata information about the external node. | ||
use vise::EncodeLabelSet; | ||
|
||
pub(crate) use self::values::RUSTC_METADATA; | ||
|
||
mod values { | ||
use super::RustcMetadata; | ||
include!(concat!(env!("OUT_DIR"), "/metadata_values.rs")); | ||
} | ||
|
||
#[derive(Debug, EncodeLabelSet)] | ||
pub(crate) struct RustcMetadata { | ||
pub version: &'static str, | ||
pub commit_hash: Option<&'static str>, | ||
pub commit_date: Option<&'static str>, | ||
pub channel: &'static str, | ||
pub host: &'static str, | ||
pub llvm: Option<&'static str>, | ||
} | ||
|
||
pub(crate) const SERVER_VERSION: &str = env!("CARGO_PKG_VERSION"); |
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
File renamed without changes.
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,36 @@ | ||
use vise::{EncodeLabelSet, Info, Metrics}; | ||
|
||
mod values { | ||
use super::RustcMetadata; | ||
include!(concat!(env!("OUT_DIR"), "/metadata_values.rs")); | ||
} | ||
|
||
use values::RUSTC_METADATA; | ||
|
||
/// Metadata of Rust compiler used to compile the crate. | ||
#[derive(Debug, EncodeLabelSet)] | ||
pub struct RustcMetadata { | ||
pub version: &'static str, | ||
pub commit_hash: Option<&'static str>, | ||
pub commit_date: Option<&'static str>, | ||
pub channel: &'static str, | ||
pub host: &'static str, | ||
pub llvm: Option<&'static str>, | ||
} | ||
|
||
#[derive(Debug, Metrics)] | ||
#[metrics(prefix = "rust")] | ||
pub struct RustMetrics { | ||
/// General information about the Rust compiler. | ||
info: Info<RustcMetadata>, | ||
} | ||
|
||
impl RustMetrics { | ||
pub fn initialize(&self) { | ||
tracing::info!("Metadata for rustc that this binary was compiled with: {RUSTC_METADATA:?}"); | ||
self.info.set(RUSTC_METADATA).ok(); | ||
} | ||
} | ||
|
||
#[vise::register] | ||
pub static RUST_METRICS: vise::Global<RustMetrics> = vise::Global::new(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.