feat: add common_version customization (#7869)

* feat: add product name customization

* chore: update tests
This commit is contained in:
Ning Sun
2026-03-26 18:18:06 +08:00
committed by GitHub
parent 1118fe243f
commit 08ded45c7a
15 changed files with 44 additions and 17 deletions

View File

@@ -54,6 +54,7 @@ common-telemetry = { workspace = true, features = [
common-time.workspace = true
common-version.workspace = true
common-wal.workspace = true
const_format.workspace = true
datafusion.workspace = true
datafusion-common.workspace = true
datafusion-physical-plan.workspace = true

View File

@@ -20,11 +20,11 @@ use cmd::error::{InitTlsProviderSnafu, Result};
use cmd::options::GlobalOptions;
use cmd::{App, cli, datanode, flownode, frontend, metasrv, standalone};
use common_base::Plugins;
use common_version::{verbose_version, version};
use common_version::{product_name, verbose_version, version};
use servers::install_ring_crypto_provider;
#[derive(Parser)]
#[command(name = "greptime", author, version, long_version = verbose_version(), about)]
#[command(name = product_name(), author, version, long_version = verbose_version(), about)]
#[command(propagate_version = true)]
pub(crate) struct Command {
#[clap(subcommand)]
@@ -52,11 +52,11 @@ enum SubCommand {
#[clap(name = "metasrv")]
Metasrv(metasrv::Command),
/// Run greptimedb as a standalone service.
/// Start service in standalone mode.
#[clap(name = "standalone")]
Standalone(standalone::Command),
/// Execute the cli tools for greptimedb.
/// Execute the cli tools.
#[clap(name = "cli")]
Cli(cli::Command),
}
@@ -148,7 +148,7 @@ async fn start(cli: Command) -> Result<()> {
fn setup_human_panic() {
human_panic::setup_panic!(
human_panic::Metadata::new("GreptimeDB", version())
human_panic::Metadata::new(product_name(), version())
.homepage("https://github.com/GreptimeTeam/greptimedb/discussions")
);

View File

@@ -21,7 +21,7 @@ use tracing_appender::non_blocking::WorkerGuard;
use crate::options::GlobalOptions;
use crate::{App, Result, error};
pub const APP_NAME: &str = "greptime-cli";
pub const APP_NAME: &str = const_format::concatcp!(common_version::product_name(), "-cli");
use async_trait::async_trait;
pub struct Instance {

View File

@@ -43,7 +43,7 @@ use crate::error::{
};
use crate::options::{GlobalOptions, GreptimeOptions};
pub const APP_NAME: &str = "greptime-datanode";
pub const APP_NAME: &str = const_format::concatcp!(common_version::product_name(), "-datanode");
type DatanodeOptions = GreptimeOptions<datanode::config::DatanodeOptions>;

View File

@@ -35,6 +35,7 @@ use common_stat::ResourceStatImpl;
use common_telemetry::info;
use common_telemetry::logging::{DEFAULT_LOGGING_DIR, TracingOptions};
use common_version::{short_version, verbose_version};
use const_format::concatcp;
use flow::{
FlownodeBuilder, FlownodeInstance, FlownodeServiceBuilder, FrontendClient, FrontendInvoker,
get_flow_auth_options,
@@ -52,7 +53,7 @@ use crate::error::{
use crate::options::{GlobalOptions, GreptimeOptions};
use crate::{App, create_resource_limit_metrics, log_versions, maybe_activate_heap_profile};
pub const APP_NAME: &str = "greptime-flownode";
pub const APP_NAME: &str = concatcp!(common_version::product_name(), "-flownode");
type FlownodeOptions = GreptimeOptions<flow::FlownodeOptions>;

View File

@@ -72,7 +72,7 @@ pub struct Instance {
_guard: Vec<WorkerGuard>,
}
pub const APP_NAME: &str = "greptime-frontend";
pub const APP_NAME: &str = const_format::concatcp!(common_version::product_name(), "-frontend");
impl Instance {
pub fn new(frontend: Frontend, _guard: Vec<WorkerGuard>) -> Self {

View File

@@ -24,6 +24,7 @@ use common_meta::distributed_time_constants::init_distributed_time_constants;
use common_telemetry::info;
use common_telemetry::logging::{DEFAULT_LOGGING_DIR, TracingOptions};
use common_version::{short_version, verbose_version};
use const_format::concatcp;
use meta_srv::bootstrap::{MetasrvInstance, metasrv_builder};
use meta_srv::metasrv::BackendImpl;
use snafu::ResultExt;
@@ -35,7 +36,7 @@ use crate::{App, create_resource_limit_metrics, log_versions, maybe_activate_hea
type MetasrvOptions = GreptimeOptions<meta_srv::metasrv::MetasrvOptions>;
pub const APP_NAME: &str = "greptime-metasrv";
pub const APP_NAME: &str = concatcp!(common_version::product_name(), "-metasrv");
pub struct Instance {
instance: MetasrvInstance,

View File

@@ -48,6 +48,7 @@ use common_telemetry::info;
use common_telemetry::logging::{DEFAULT_LOGGING_DIR, TracingOptions};
use common_time::timezone::set_default_timezone;
use common_version::{short_version, verbose_version};
use const_format::concatcp;
use datanode::config::DatanodeOptions;
use datanode::datanode::{Datanode, DatanodeBuilder};
use datanode::region_server::RegionServer;
@@ -75,7 +76,7 @@ use crate::error::{OtherSnafu, Result, StartFlownodeSnafu};
use crate::options::{GlobalOptions, GreptimeOptions};
use crate::{App, create_resource_limit_metrics, error, log_versions, maybe_activate_heap_profile};
pub const APP_NAME: &str = "greptime-standalone";
pub const APP_NAME: &str = concatcp!(common_version::product_name(), "-standalone");
#[derive(Parser)]
pub struct Command {