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 all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
3 changes: 2 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 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
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");
}
2 changes: 0 additions & 2 deletions core/bin/external_node/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,6 @@ impl From<ExternalNodeConfig> for InternalApiConfig {
req_entities_limit: config.optional.req_entities_limit,
fee_history_limit: config.optional.fee_history_limit,
filters_disabled: config.optional.filters_disabled,
mempool_cache_update_interval: config.optional.mempool_cache_update_interval(),
mempool_cache_size: config.optional.mempool_cache_size,
dummy_verifier: config.remote.dummy_verifier,
l1_batch_commit_data_generator_mode: config.remote.l1_batch_commit_data_generator_mode,
}
Expand Down
Loading
Loading