-
Notifications
You must be signed in to change notification settings - Fork 183
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
Print version information when the program starts #112
Comments
I find a solution for adding build numbers from git, take a look at this. |
Looks great! I think it is what we want. We could insert it as a parameter when building the collector, like |
add_definitions(-DBUILD_NUMBER)
find_package(Git)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --match build
OUTPUT_VARIABLE BUILD_NUMBER
OUTPUT_STRIP_TRAILING_WHITESPACE)
add_definitions(-DBUILD_NUMBER=\ "${BUILD_NUMBER}\")
endif()
Add this code into CMakeLists.txt of probe, then just use |
But now we are compiling the probe using Bazel, is there any similar method? @jundizhou |
I haven't found a way to inject version information into a program with bazel. Maybe we can generate a header file with a .sh file like this commit_ts=`git log -1 --format="%ct"`
commit_time=`date -d@$commit_ts +"%Y-%m-%d %H:%M:%S"`
current_time=`date +"%Y-%m-%d %H:%M:%S"`
git_version=`git log -1 --format="%h"`
build_number=`git describe`
sed s/MYVERSION/"version: $build_number commit: $commit_time build: $current_time"/g version.h.tmp > version.h
make clean
make There will be a macro in the generated header file #ifndef _VERSION_
#define _VERSION_ "version: build01-5-g4e4dc12 commit: 2022-03-22 12:57:52 build: 2022-03-22 13:01:26"
#endif Would it work in our project? |
The version of the probe is not needed after merging #264 because there is only one process now. The collector and the probe share the same codebase and the commit id has been printed by the collector. |
Is your feature request related to a problem? Please describe.
Whenever an error occurs, we want to know clearly which version of codes the agent is on. But now there is no such information printed by the collector and only an outdated
KINDLING_PROBE_VERSION: v0.1-2021-1221
printed by the probe. We can't know the exact versions of them now.Describe the solution you'd like
The best version information is the combination of the release version and the commit revision number, IMO. We could insert these numbers as environment variables when we build the containers and print them periodically while the agent is running.
Additional context
Any ideas about how we could get this information are appreciated.
The text was updated successfully, but these errors were encountered: