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
Report the agent version to OAP #397
Conversation
Date of build failed in our test in the OAP side. So, we only have version + commit. Ref the main repo version number generator. cc @kezhenxu94 |
I remember we have already reported the agent version to OAP long time ago, although we didn't persist the version into storage. |
Where? I think this is helpful, agent version should persist with the instance info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR also doesn't take the source release tar ball into consideration, if the users download our source tar (without git metadata at all), and build from source, the version number is undefined in this case, please also refer to https://github.com/apache/skywalking/pull/8004/files#diff-86b1ad012d67ec23f3a775179150ce4d2af54836a4156c0921aad37f2c671a05
It's easy to solve, we could use the maven-ant-plugin to copy this file to the skywalking agent distribution folder. |
Read the following class Lines 41 to 42 in 70b3e88
|
@kezhenxu94 OKay, thanks. I take a look first. |
@wu-sheng @kezhenxu94
Thank you all, if you have any suggestions, please let me know. |
There is no reason for us to doubt why they build from source code tarball, we as an Apache project are mandatory to provide source tarball and guarantee that users can use the project after compilation from that tarball. I'm totally fine to let the version be
|
As an instance property, it is on the UI already. Instance table includes the attribute column to list this. |
@kezhenxu94 |
...core/src/main/java/org/apache/skywalking/apm/agent/core/util/InstanceJsonPropertiesUtil.java
Outdated
Show resolved
Hide resolved
If we need this version property, then source tar should be covered. |
Okay, I will find the solution for source tarball recently. |
If you have no better idea, take a look at how OAP did this |
@kezhenxu94 Thanks, I will take a look. |
...iffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/version/Version.java
Outdated
Show resolved
Hide resolved
This PR I almost finish. Two more things I need to confirm:
|
|
@wu-sheng @kezhenxu94 Once the version properties file has been generated, the When we package the agent with When we package the agent from the source tarball, as the |
I think we should have two files, one for commit id, the other is for final version number. Then we could make sure the version suffix is correct. |
Could you explain more about why we need two files? This PR is finished, please consider this implementation. Now we could generate the agent version in the git repo scenario and the source tarball scenario. And the build time will be ignored when users build the agent from the source tarball. Here are the agent logs I tested. 1. Agent log, built from git repo
if we run
2. Agent log, built from source tarball
|
I want to keep both scenarios having the same version style. Because in the ASF, only the source tar build is the real release. |
Okay, If you insist keep them have the same style, I think |
When we package the source tar, we should ship the commit into a file. Then when building binary from source tar, it should generate the same version. |
This works for me too. |
3bb8eaa
to
17f4409
Compare
@wu-sheng @kezhenxu94 The BTW, what the |
Please fix CI, and you should update the e2e to include your new property, https://github.com/apache/skywalking-java/blob/main/test/e2e/case/expected/service-instance.yml |
@wu-sheng The CI has been fixed. |
I think we need some fixes for some tests, which don't lock the Spring version. With the latest Sprinv boot 3.x released, it fails. Would you like to fix them in another PR first? |
Okay, I will take a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am good with the idea and version format, version + commit ID
.
Pending on @kezhenxu94 to review the codes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@nisiyong Could you update the showcase repository to this commit? This could make our demo env show the version of the agent, at least for the Java agent |
Sure, I will take some time to do it ASAP. |
Report the agent version to OAP
Currently, the agent version used by all applications cannot be sensed, It is beneficial for agent developers to diagnose some problems, and help us find which applications haven't upgraded the agent. I use git-commit-id-maven-plugin to generate the agent version, and report it to OAP when the agent starts.
The agent version is consist of three parts:
Here is the agent log from my local env with this feature:
And the OAP server could show this agent version, too. What do you think of this feature? Any suggestions? @wu-sheng
CHANGES
log.