Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Expose component configs as info metrics #1584

Merged
merged 19 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/release-please/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
"packages": {
"core": {
"release-type": "simple",
"component": "core"
"component": "core",
"extra-files": [
{
"type": "generic",
"path": "bin/external_node/Cargo.toml"
}
]
},
"prover": {
"release-type": "simple",
Expand Down
70 changes: 39 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ regex = "1"
reqwest = "0.11"
rlp = "0.5"
rocksdb = "0.21.0"
rustc_version = "0.4.0"
secp256k1 = "0.27.0"
semver = "1"
sentry = "0.31"
Expand Down Expand Up @@ -157,8 +158,8 @@ circuit_sequencer_api_1_4_1 = { package = "circuit_sequencer_api", git = "https:
circuit_sequencer_api_1_4_2 = { package = "circuit_sequencer_api", git = "https://github.com/matter-labs/era-zkevm_test_harness.git", branch = "v1.4.2" }
crypto_codegen = { package = "codegen", git = "https://github.com/matter-labs/solidity_plonk_verifier.git", branch = "dev" }
kzg = { package = "kzg", git = "https://github.com/matter-labs/era-zkevm_test_harness.git", branch = "v1.4.2" }
vise = { git = "https://github.com/matter-labs/vise.git", version = "0.1.0", rev = "1c9cc500e92cf9ea052b230e114a6f9cce4fb2c1" }
vise-exporter = { git = "https://github.com/matter-labs/vise.git", version = "0.1.0", rev = "1c9cc500e92cf9ea052b230e114a6f9cce4fb2c1" }
vise = { git = "https://github.com/matter-labs/vise.git", version = "0.1.0", rev = "a5bb80c9ce7168663114ee30e794d6dc32159ee4" }
vise-exporter = { git = "https://github.com/matter-labs/vise.git", version = "0.1.0", rev = "a5bb80c9ce7168663114ee30e794d6dc32159ee4" }
zk_evm = { git = "https://github.com/matter-labs/era-zk_evm.git", tag = "v1.3.3-rc2" }
zk_evm_1_3_1 = { package = "zk_evm", git = "https://github.com/matter-labs/era-zk_evm.git", tag = "v1.3.1-rc2" }
zk_evm_1_3_3 = { package = "zk_evm", git = "https://github.com/matter-labs/era-zk_evm.git", tag = "v1.3.3-rc2" }
Expand Down Expand Up @@ -218,3 +219,7 @@ zksync_crypto_primitives = { path = "core/lib/crypto_primitives" }
zksync_node_framework = { path = "core/node/node_framework" }
zksync_eth_watch = { path = "core/node/eth_watch" }
zksync_shared_metrics = { path = "core/node/shared_metrics" }

# FIXME: remove after consensus crates are updated
[replace]
slowli marked this conversation as resolved.
Show resolved Hide resolved
"https://github.com/matter-labs/vise.git#vise:0.1.0" = { git = "https://github.com/matter-labs/vise.git", rev = "a5bb80c9ce7168663114ee30e794d6dc32159ee4" }
5 changes: 4 additions & 1 deletion core/bin/external_node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zksync_external_node"
version = "0.1.0"
version = "22.1.0" # x-release-please-version
slowli marked this conversation as resolved.
Show resolved Hide resolved
edition.workspace = true
authors.workspace = true
homepage.workspace = true
Expand Down Expand Up @@ -44,3 +44,6 @@ clap = { workspace = true, features = ["derive"] }
serde_json.workspace = true
semver.workspace = true
tracing.workspace = true

[build-dependencies]
rustc_version.workspace = true
46 changes: 46 additions & 0 deletions core/bin/external_node/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//! Build script for the external node binary.

use std::{
env, fs,
io::{self, Write},
path::Path,
};

use rustc_version::{Channel, LlvmVersion};

fn print_rust_meta(out: &mut impl Write, meta: &rustc_version::VersionMeta) -> io::Result<()> {
writeln!(
out,
"pub(crate) const RUSTC_METADATA: RustcMetadata = RustcMetadata {{ \
version: {semver:?}, \
commit_hash: {commit_hash:?}, \
commit_date: {commit_date:?}, \
channel: {channel:?}, \
host: {host:?}, \
llvm: {llvm:?} \
}};",
semver = meta.semver.to_string(),
commit_hash = meta.commit_hash,
commit_date = meta.commit_date,
channel = match meta.channel {
Channel::Dev => "dev",
Channel::Beta => "beta",
Channel::Nightly => "nightly",
Channel::Stable => "stable",
},
host = meta.host,
llvm = meta.llvm_version.as_ref().map(LlvmVersion::to_string),
)
}

fn main() {
let out_dir = env::var("OUT_DIR").expect("`OUT_DIR` env var not set for build script");
let rustc_meta = rustc_version::version_meta().expect("Failed obtaining rustc metadata");

let metadata_module_path = Path::new(&out_dir).join("metadata_values.rs");
let metadata_module =
fs::File::create(metadata_module_path).expect("cannot create metadata module");
let mut metadata_module = io::BufWriter::new(metadata_module);

print_rust_meta(&mut metadata_module, &rustc_meta).expect("failed printing rustc metadata");
}