-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add agent.{id,ephemeral_id} to all beat events #9404
Conversation
Pinging @elastic/uptime |
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 on adding this feature. @urso your input would be good here.
libbeat/beat/info.go
Outdated
Name string // configured beat name | ||
Hostname string // hostname | ||
UUID uuid.UUID // ID assigned to beat instance | ||
EphemeralUUID uuid.UUID // ID assigned to beat instance |
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.
We already have a ephemeral id: https://github.com/elastic/beats/blob/master/libbeat/cmd/instance/metrics_common.go#L31
Yes, not easy to find. I think here is a better place for it.
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.
Errr, this isn't a new UUID, we pull it from https://github.com/elastic/beats/pull/9404/files#diff-73bd591578392eb2d281f4778ac9a47eR88
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.
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.
Actually, it already is pulled from where you mentioned (this line is the type declaration)
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 on this change.
As we convert them to strings anyway (which needs an alloc) how about changing the fields to string and name them ID and EphemeralID (yeah I know this would be a breaking change)?
@urso yeah, I'm glad to rename |
fc4b6a9
to
66b03ba
Compare
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.
Wearing my ECS hat, this LGTM.
I can't comment much on the Go code (although it looks good to me).
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 also needs a changelog entry. Overall LGTM.
@@ -26,7 +26,8 @@ type Info struct { | |||
Version string // The beat version. Defaults to the libbeat version when an implementation does not set a version | |||
Name string // configured beat name | |||
Hostname string // hostname | |||
UUID uuid.UUID // ID assigned to beat instance | |||
ID uuid.UUID // ID assigned to beat machine |
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.
Why did you change thsi to beat machine
from instance? This is unique for each instance.
66b03ba
to
a0d9141
Compare
Hit a flaky test. This PR is now blocked on the |
@ruflin changelog entry added. Let me know if we're LGTM (though we'll still be blocked on the Flaky test merge) |
@andrewvc The tests that are failing are golden files which do not seem to be up-to-date. But I could not reproduce it locally. Any chance you could rebase on master and see if it still happens? |
00bf3c2
to
f48a716
Compare
@andrewvc I just realised now that the failing tests are actually correct. The reason is that we have added a new field to Beats so it affects the golden files. To update them run the following commands:
Hope it has no typos inside. Please let me know if you need some help with the above. |
f48a716
to
4ac324d
Compare
@ruflin I ran those commands but it only updated some of the stuff in c246f83 . Still getting test failures: https://beats-ci.elastic.co/job/elastic+beats+pull-request+multijob-linux/2507/beat=filebeat,label=ubuntu/ |
The problem is that the agent_id and ephemeral id change every time. So we should skip these two fields. Let me fix it locally and provide you with the code. |
Can you try to replace line https://github.com/elastic/beats/blob/master/filebeat/tests/system/test_modules.py#L189 with the following content?
This exclude the two ids from being generated. Afterwards you need to run the command again. |
cf1c63e
to
853ee4d
Compare
I did run the branch locally and on my end it removes the ids also from the files which still contain it in this PR. Not sure what happened? Can you run it again? |
853ee4d
to
dd19ce0
Compare
Hmmm, still getting errors on filebeat. Looks like it's still looking for agent.id? https://beats-ci.elastic.co/job/elastic+beats+pull-request+multijob-linux/2605/ |
@andrewvc Yes, some files still have agent.id inside: https://github.com/elastic/beats/pull/9404/files#diff-adbf1bb07ce8f5f874891602efc0f5e7R4 |
30a0f8b
to
0f3bc0c
Compare
jenkins, please retest this |
0f3bc0c
to
f0745af
Compare
OK , just rebased with a Anything else needed here @ruflin? FYI, this PR has a high chance of needing extra rebases due to it being sensitive to any field changes in any other beat. |
f0745af
to
fb2e6f1
Compare
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 cleaned up the changelog but found one more change that should be reverted and needs make update
afterwards.
4862126
to
9499a05
Compare
@andrewvc Can you rebase this one? @kuisathaverat One interesting thing I saw in this PR: It seems the Check step in the Jenkinsfile fails here because of a merge conflict. Does this mean what the Jenkinsfile tests is the PR merged with master? |
3e745a5
to
5b46ed4
Compare
yes, the default configuration makes a merge before building the PR. |
This adds the ECS fields `agent.id` and `agent.ephemeral_id` to all beats.
5b46ed4
to
153ed37
Compare
Failure unrelated |
I don't see a need to backport this at the moment. |
No need to backport. We found this change to break indexing if |
* Add agent.{id,ephemeral_id} to all beat events This adds the ECS fields `agent.id` and `agent.ephemeral_id` to all beats. * Bring back whitespace * Use CHANGELOG.next * Update fb tests
This adds the ECS fields
agent.id
andagent.ephemeral_id
to all beats.Heartbeat in particular needs these to execute aggregations queries in dashboards.
I could use some feedback here on the best place to add tests. AFAICT existing similar functionality for these baseline fields is not tested. Thoughts @urso ?