Skip to content
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
5 changes: 4 additions & 1 deletion be/src/common/version_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ int doris_build_version_minor() {
int doris_build_version_patch() {
return DORIS_BUILD_VERSION_PATCH;
}
int doris_build_version_hotfix() {
return DORIS_BUILD_VERSION_HOTFIX;
}
const char* doris_build_version_rc_version() {
return DORIS_BUILD_VERSION_RC_VERSION;
}
Expand All @@ -56,4 +59,4 @@ const char* doris_build_info() {

} // namespace version

} // namespace doris
} // namespace doris
3 changes: 2 additions & 1 deletion be/src/common/version_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extern const char* doris_build_version_prefix();
extern int doris_build_version_major();
extern int doris_build_version_minor();
extern int doris_build_version_patch();
extern int doris_build_version_hotfix();
extern const char* doris_build_version_rc_version();

extern const char* doris_build_version();
Expand All @@ -34,4 +35,4 @@ extern const char* doris_build_info();

} // namespace version

} // namespace doris
} // namespace doris
11 changes: 11 additions & 0 deletions be/src/util/debug_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "util/debug_util.h"

#include <bvar/bvar.h>
#include <gen_cpp/HeartbeatService_types.h>
#include <gen_cpp/PlanNodes_types.h>
#include <stdint.h>
Expand Down Expand Up @@ -104,6 +105,16 @@ std::string hexdump(const char* buf, int len) {
return ss.str();
}

bvar::Status<uint64_t> be_version_metrics("doris_be_version", [] {
std::stringstream ss;
ss << version::doris_build_version_major() << 0 << version::doris_build_version_minor() << 0
<< version::doris_build_version_patch();
if (version::doris_build_version_hotfix() > 0) {
ss << 0 << version::doris_build_version_hotfix();
}
return std::strtoul(ss.str().c_str(), nullptr, 10);
}());

std::string PrintThriftNetworkAddress(const TNetworkAddress& add) {
std::stringstream ss;
add.printTo(ss);
Expand Down
3 changes: 3 additions & 0 deletions cloud/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ bvar::Status<uint64_t> doris_cloud_version_metrics("doris_cloud_version", [] {
std::stringstream ss;
ss << DORIS_CLOUD_BUILD_VERSION_MAJOR << 0 << DORIS_CLOUD_BUILD_VERSION_MINOR << 0
<< DORIS_CLOUD_BUILD_VERSION_PATCH;
if (DORIS_CLOUD_BUILD_VERSION_HOTFIX > 0) {
ss << 0 << DORIS_CLOUD_BUILD_VERSION_HOTFIX;
}
return std::strtoul(ss.str().c_str(), nullptr, 10);
}());

Expand Down
20 changes: 20 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/metric/MetricRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.doris.common.Config;
import org.apache.doris.common.Pair;
import org.apache.doris.common.ThreadPoolManager;
import org.apache.doris.common.Version;
import org.apache.doris.common.util.NetUtils;
import org.apache.doris.load.EtlJobType;
import org.apache.doris.load.loadv2.JobState;
Expand Down Expand Up @@ -158,6 +159,25 @@ public static synchronized void init() {
return;
}

// version
GaugeMetric<Long> feVersion = new GaugeMetric<Long>("version", MetricUnit.NOUNIT, "") {
@Override
public Long getValue() {
try {
return Long.parseLong("" + Version.DORIS_BUILD_VERSION_MAJOR + "0"
+ Version.DORIS_BUILD_VERSION_MINOR + "0"
+ Version.DORIS_BUILD_VERSION_PATCH
+ (Version.DORIS_BUILD_VERSION_HOTFIX > 0
? ("0" + Version.DORIS_BUILD_VERSION_HOTFIX)
: ""));
} catch (Throwable t) {
LOG.warn("failed to init version metrics", t);
return 0L;
}
}
};
DORIS_METRIC_REGISTER.addMetrics(feVersion);

// load jobs
for (EtlJobType jobType : EtlJobType.values()) {
if (jobType == EtlJobType.UNKNOWN) {
Expand Down
25 changes: 19 additions & 6 deletions gensrc/script/gen_build_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ build_version_prefix="doris"
build_version_major=0
build_version_minor=0
build_version_patch=0
build_version_hotfix=0
build_version_rc_version=""

build_version="${build_version_prefix}-${build_version_major}.${build_version_minor}.${build_version_patch}-${build_version_rc_version}"
build_version="${build_version_prefix}-${build_version_major}.${build_version_minor}.${build_version_patch}"
if [[ ${build_version_hotfix} > 0 ]]; then
build_version+=".${build_version_hotfix}"
fi
build_version+="-${build_version_rc_version}"

# This version is used to check FeMetaVersion is not changed during release
build_fe_meta_version=0
Expand Down Expand Up @@ -125,6 +130,7 @@ public class Version {
public static final int DORIS_BUILD_VERSION_MAJOR = ${build_version_major};
public static final int DORIS_BUILD_VERSION_MINOR = ${build_version_minor};
public static final int DORIS_BUILD_VERSION_PATCH = ${build_version_patch};
public static final int DORIS_BUILD_VERSION_HOTFIX = ${build_version_hotfix};
public static final String DORIS_BUILD_VERSION_RC_VERSION = "${build_version_rc_version}";

public static final String DORIS_BUILD_VERSION = "${build_version}";
Expand Down Expand Up @@ -186,6 +192,7 @@ namespace doris {
#define DORIS_BUILD_VERSION_MAJOR ${build_version_major};
#define DORIS_BUILD_VERSION_MINOR ${build_version_minor};
#define DORIS_BUILD_VERSION_PATCH ${build_version_patch};
#define DORIS_BUILD_VERSION_HOTFIX ${build_version_hotfix};
#define DORIS_BUILD_VERSION_RC_VERSION "${build_version_rc_version}";

#define DORIS_BUILD_VERSION "${build_version}"
Expand All @@ -203,11 +210,12 @@ EOF
# doris cloud version info
################################################################################

build_version_prefix="doris_cloud"
build_version_major=0
build_version_minor=0
build_version_patch=0
build_version_rc_version=""
# build_version_prefix="doris_cloud"
# build_version_major=0
# build_version_minor=0
# build_version_patch=0
# build_version_hotfix=0
# build_version_rc_version=""

if [[ -f /etc/os-release ]]; then
build_os_version=$(head -n2 </etc/os-release | tr '\n' ' ')
Expand All @@ -217,6 +225,10 @@ fi

build_version="${build_version_prefix}-${build_version_major}.${build_version_minor}.${build_version_patch}"

if [[ ${build_version_hotfix} > 0 ]]; then
build_version+=".${build_version_hotfix}"
fi

if [[ "${build_version_rc_version}" != "" ]]; then
build_version=${build_version}"-${build_version_rc_version}"
fi
Expand Down Expand Up @@ -247,6 +259,7 @@ namespace doris::cloud {
#define DORIS_CLOUD_BUILD_VERSION_MAJOR ${build_version_major}
#define DORIS_CLOUD_BUILD_VERSION_MINOR ${build_version_minor}
#define DORIS_CLOUD_BUILD_VERSION_PATCH ${build_version_patch}
#define DORIS_CLOUD_BUILD_VERSION_HOTFIX ${build_version_hotfix}
#define DORIS_CLOUD_BUILD_VERSION_RC_VERSION R"(${build_version_rc_version})"

#define DORIS_CLOUD_BUILD_VERSION R"(${build_version})"
Expand Down
Loading