-
Notifications
You must be signed in to change notification settings - Fork 154
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
Send package.version to components #4024
Send package.version to components #4024
Conversation
This pull request is now in conflicts. Could you fix it? 🙏
|
45f85c2
to
00afbc2
Compare
dev-tools/mage/gotool/go.go
Outdated
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.
Once #4039 is merged, this changes won't me o this PR anymore
dev-tools/notice/overrides.json
Outdated
@@ -1,4 +1,5 @@ | |||
{"name": "github.com/elastic/beats/v7", "licenceType": "Elastic"} | |||
{"name": "github.com/AndersonQ/elastic-agent-client/v7", "licenceType": "Elastic"} |
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.
It'll be removed once elastic/elastic-agent-client#93 is merged
The integration test we are going to want here will be to change the agent package version file at install time to be something different from what the agent was built with. You can edit it to something the build will never produce, like set it to 8.0.5000+build19700101 for example. Then install the agent, ensure it can enroll in Fleet, and verify the documents ingested into Elasticsearch actually have that version in the You could probably just update the existing log ingestion tests to operate with a modified package version to cover this. https://github.com/elastic/elastic-agent/blob/main/testing/integration/logs_ingestion_test.go You'd have to inspect the version fields in the returned documents in addition to what it does now, but this will be easier and execute faster than writing a completely new test. |
This pull request is now in conflicts. Could you fix it? 🙏
|
f7690b8
to
2d18ca4
Compare
6977cce
to
452b709
Compare
…port-package-version
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.
After discussing with @AndersonQ and the comments from @cmacknz it is now clear to me that the hash we use in component state is not a blocker.
The hacking of the version in TestComponentBuildHashInDiagnostics is a bit worrying as it will probably stop working when the version is used in the agent install path but right now is not a blocker (the test will need to be fixed or disabled if it stops working after #2579 is implemented.
…to beats-report-package-version
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.
Overall this looks good. I question the need for the changelog entry though.
kind: feature | ||
|
||
# Change summary; a 80ish characters long description of the change. | ||
summary: Agent information is sent to components together with the connection information. |
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.
Is this really informational for our users? I don't think they care, this is more an internal change and not something that affects the usage of the Elastic Agent.
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 tend to agree, this change is more an internal change than something the users should pay attention at
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.
+1 we can remove the changelog entry here.
Quality Gate passedThe SonarQube Quality Gate passed, but some issues were introduced. 4 New issues |
Tested this manually, looks like it works. The I did note that the build hash field is not included in the version info output from - id: system/metrics-default
name: system/metrics
state: 2
message: 'Healthy: communicating with pid ''86008'''
units:
- unit_id: system/metrics-default
unit_type: 1
state: 2
message: Healthy
- unit_id: system/metrics-default-system/metrics-system-56875859-e15e-48ab-ad98-29698fd331ad
unit_type: 0
state: 2
message: Healthy
version_info:
name: beat-v2-client
meta:
build_time: 2024-02-06 11:59:31 +0000 UTC
commit: ac6e2230bcfe766f1bd5695a59aa7d55116098f7 It is included in the - id: system/metrics-default
state:
component:
apmconfig: null
limits:
gomaxprocs: 0
source:
fields:
go_max_procs:
kind:
numbervalue: 0
component_idx: 2
features_idx: 2
message: 'Healthy: communicating with pid ''86008'''
state: 2
units:
input-system/metrics-default-system/metrics-system-56875859-e15e-48ab-ad98-29698fd331ad:
message: Healthy
state: 2
output-system/metrics-default:
message: Healthy
state: 2
version_info:
build_hash: ac6e2230bcfe766f1bd5695a59aa7d55116098f7
meta:
build_time: 2024-02-06 11:59:31 +0000 UTC
commit: ac6e2230bcfe766f1bd5695a59aa7d55116098f7
name: beat-v2-client |
Interesting, the
I'll open an issue to fix the status command as a whole then |
What does this PR do?
The agent now includes AgentInfo alongside the connection information during component startup. It also stores the BuildHash sent by the components as part of the ComponentVersionInfo during check-in.
To facilitate testing, an info.Agent interface has been created to abstract the implementation of info.AgentInfo. This abstraction allows for the creation of mocks, enabling testing scenarios where using
info.NewAgentInfo
is impractical. This is becauseinfo.NewAgentInfo
relies on the agent vault, which, on Mac systems, is the system's keychain. Accessing the keychain requires root permissions, which are not available during testing.Why is it important?
The components should report the package version instead of their own.
Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files./changelog/fragments
using the changelog toolHow to test this PR locally
With a beats build containing elastic/beats#37553:
8.13.0+build20131123
agent.version
,elastic_agent.version
andmetadata.version
set as the version defined on thepackage.version
file.state.yaml
from the agent diagnostics, for each component, there should be:version
field in theversion_info
version_info.build_hash
with the beats build hashRelated issues
Related PRs
Questions to ask yourself