-
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
[Heartbeat] Migrate to ECS url.* fields for 7.0.0 Release #9570
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.
LGTM :-)
Reviewed too fast. The mapping is good, but the work isn't done ;-)
35b54a3
to
a158ec2
Compare
@ruflin ready to have a look taken at the code even though tests are broken. |
a158ec2
to
43ba941
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.
Does this PR also need a changelog entry?
@@ -625,3 +625,8 @@ | |||
to: event.dataset | |||
alias: false | |||
comment: No alias mapping as field did not always exist | |||
|
|||
- from: http.url |
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 would also expect a change to the fields.yml file that introduces this alias?
Also in the code I couldn't find where http.url
is removed?
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.
Right now it's just being duplicated and we're relying on ECS to provide that field as a non-alias.
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.
If you're going to keep the original http.url
field present and just copy its value, you should remove the entry from ecs-migration.yml
.
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 should still show up here if we potentially need to migrate this in the dashboards.
But in case we keep the old field around, alias: true
should be set to false as we can't create an alias for the old field.
43ba941
to
767df2e
Compare
767df2e
to
84dcc3a
Compare
@ruflin @webmat OK, so I took this a lot further and refactored all the monitors to use the This actually cleans up the code in heartbeat quite a bit, which is a good sign I think! It lets a lot of the event field population happen at a high level (before the task is started) rather than deep in the bowels of the event's execution, and lets it happen consistently with a couple simple helper functions. This is of course a 7.0.0 only change, and breaks cases where people use fields directly. I made an effort to alias all the moved fields and document them as well. |
@ruflin I believe I've addressed all of your concerns |
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.
Looking good overall.
However you shouldn't list http.url as aliased to url.full in ecs-migration.yml, if it's only copied. Unless I misunderstand something about this?
"github.com/elastic/beats/libbeat/common" | ||
) | ||
|
||
func TestURLFields(t *testing.T) { |
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 whole test file
@@ -625,3 +625,8 @@ | |||
to: event.dataset | |||
alias: false | |||
comment: No alias mapping as field did not always exist | |||
|
|||
- from: http.url |
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.
If you're going to keep the original http.url
field present and just copy its value, you should remove the entry from ecs-migration.yml
.
@webmat I changed this PR since I first wrote it. Now there are no copies. Just aliases, so this is a breaking change for 7.0.0. |
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.
What I would like to see in the changelog is having pairs of field old -> new
to easily follow what changed. So if someone had queries on these fields and looks at the changes, it's very easy for him to decide what to rename it to. Yes, the ecs-migration.yml would also be there for a look up but I don't expect users to check there. Also having it in the PR description would be nice as we do for other ECS migration PR's.
In metricbeat we create these data.json
with example events: https://github.com/elastic/beats/blob/master/metricbeat/module/elasticsearch/index_recovery/_meta/data.json We use these also in the docs. This would be super nice for Heartbeat to have and would make it more obvious what things change in such PR's. No need to add something like this in this PR but an idea for the future.
e7b2cda
to
0a99c71
Compare
@ruflin I think I've addressed all concerns here aside from the |
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
The field by field explicit listing of the fields migrated is way out of scope for this. We should just generate one massive (and extremely boring) documentation file for the website, to list them.
Thanks @webmat ! FWIW I did add that to the changelog already. |
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
Left 2 more minor comments but can be addressed in a follow up PR.
Could you after merge update the PR description as at the moment it's not fully in line with what we have in the final PR.
description: > | ||
Service url used by monitor. | ||
multi_fields: |
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.
The type of the field changed here because of ECS. It means we don't have the indexed field anymore (text
). Should this also be mentioned somewhere?
This field encodes a full URL version of the monitor, and adds URL encodings for HTTP, TCP, and ICMP. Fix tests, unify host behavior Use all ECS URL fields Alias heartbeat fields to ECS ones Refactor URL assignment Fix failing tests Add changelog entry Add required comments Fix PY testS Improve docs Fix samples Minor improvements to migration yml Fix imports Incorporate PR feedback Don't ignore URL parse errors Make update
a2f49c6
to
9894b2f
Compare
Failures unrelated |
Continues the work in elastic#9570 , aliasing this field for convenience. In ECS this field is already a keyword, so this should be fine.
This PR migrates a number of different heartbeat fields to their ECS counterparts in the
url.*
namespace.This now addsurl.full
for all monitor types. It's still WIP since the tests haven't been updated, but I wanted to makes sure what it does is correct.