Skip to content
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] Fix broken data_stream assignment #27535

Merged
merged 16 commits into from
Aug 25, 2021

Conversation

andrewvc
Copy link
Contributor

@andrewvc andrewvc commented Aug 20, 2021

Fixes #27478

This PR fixes the logic behind assigning the data_steam.dataset field.

Previously this was static per monitor type, only the index would change, but not the field. This makes the processor more comprehensive handling not just index naming but field generation.

No release note because it doesn't fix any public bugs.

Checklist

  • My code follows the style guidelines of this project
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works

How to test this PR locally

Fixes elastic#27478

This PR fixes the logic behind assigning the data_steam.dataset field.

Previously this was static per monitor type, only the index would
change, but not the field. This makes the processor more comprehensive
handling not just index naming but field generation.
@andrewvc andrewvc self-assigned this Aug 20, 2021
@andrewvc andrewvc requested a review from a team as a code owner August 20, 2021 15:28
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Aug 20, 2021
@andrewvc andrewvc added the Team:obs-ds-hosted-services Label for the Observability Hosted Services team label Aug 20, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/uptime (Team:Uptime)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Aug 20, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Aug 20, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-08-25T16:01:11.246+0000

  • Duration: 152 min 29 sec

  • Commit: 96e006d

Test stats 🧪

Test Results
Failed 0
Passed 53711
Skipped 5324
Total 59035

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 53711
Skipped 5324
Total 59035

Copy link
Member

@vigneshshanmugam vigneshshanmugam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -119,10 +119,6 @@ func newCommonPublishConfigs(info beat.Info, cfg *common.Config) (pipetool.Confi
fields := clientCfg.Processing.Fields.Clone()
fields.Put("event.dataset", dataset)

if settings.DataStream != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think i added this as a fix for Heartbeat not recognizing the data stream when used inside agent - #26774.

I hope it still works without this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just moved the logic to the add_data_stream processor. So, it's still running.

if event.Fields == nil {
event.Fields = common.MapStr{}
}
event.PutValue("data_stream", eventDataStream)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha so we just moved the logic here 👍🏽

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

Copy link

@dominiqueclarke dominiqueclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM for screenshot and network data streams.
Screen Shot 2021-08-20 at 2 53 35 PM
Screen Shot 2021-08-20 at 2 45 31 PM

@andrewvc
Copy link
Contributor Author

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Aug 23, 2021

Command update: success

Branch has been successfully updated

@andrewvc
Copy link
Contributor Author

This should now fix event.dataset and the setting of other fields to be more consistent and clear in its logic in heartbeat.

This is now a breaking change, setting event.dataset consistently to the monitor type rather than the old value of uptime. Since this field is unlikely to have been used by anyone the impact is low, and it will bring us inline with the ECS spec requiring this field to match event.dataset.

@andrewvc
Copy link
Contributor Author

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Aug 25, 2021

Command update: success

Branch has been successfully updated

Copy link
Member

@vigneshshanmugam vigneshshanmugam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with new changes. Much cleaner indeed!

@andrewvc andrewvc merged commit 12df9f7 into elastic:master Aug 25, 2021
@andrewvc andrewvc deleted the fix-ds-assign branch August 25, 2021 19:31
@andrewvc
Copy link
Contributor Author

@Mergifyio backport 7.x

@andrewvc
Copy link
Contributor Author

@Mergifyio backport 7.15

mergify bot pushed a commit that referenced this pull request Aug 25, 2021
This PR fixes the logic behind assigning the data_steam.dataset field.

Previously this was static per monitor type, only the index would change, but not the field. This makes the processor more comprehensive handling not just index naming but field generation.

This is a breaking change, setting event.dataset consistently to the monitor type rather than the old value of uptime. Since this field is unlikely to have been used by anyone the impact is low, and it will bring us inline with the ECS spec requiring this field to match event.dataset.

(cherry picked from commit 12df9f7)
@mergify
Copy link
Contributor

mergify bot commented Aug 25, 2021

Command backport 7.x: success

Backports have been created

mergify bot pushed a commit that referenced this pull request Aug 25, 2021
This PR fixes the logic behind assigning the data_steam.dataset field.

Previously this was static per monitor type, only the index would change, but not the field. This makes the processor more comprehensive handling not just index naming but field generation.

This is a breaking change, setting event.dataset consistently to the monitor type rather than the old value of uptime. Since this field is unlikely to have been used by anyone the impact is low, and it will bring us inline with the ECS spec requiring this field to match event.dataset.

(cherry picked from commit 12df9f7)
@mergify
Copy link
Contributor

mergify bot commented Aug 25, 2021

Command backport 7.15: success

Backports have been created

andrewvc added a commit that referenced this pull request Aug 25, 2021
This PR fixes the logic behind assigning the data_steam.dataset field.

Previously this was static per monitor type, only the index would change, but not the field. This makes the processor more comprehensive handling not just index naming but field generation.

This is a breaking change, setting event.dataset consistently to the monitor type rather than the old value of uptime. Since this field is unlikely to have been used by anyone the impact is low, and it will bring us inline with the ECS spec requiring this field to match event.dataset.

(cherry picked from commit 12df9f7)

Co-authored-by: Andrew Cholakian <andrew@andrewvc.com>
andrewvc added a commit that referenced this pull request Aug 25, 2021
This PR fixes the logic behind assigning the data_steam.dataset field.

Previously this was static per monitor type, only the index would change, but not the field. This makes the processor more comprehensive handling not just index naming but field generation.

This is a breaking change, setting event.dataset consistently to the monitor type rather than the old value of uptime. Since this field is unlikely to have been used by anyone the impact is low, and it will bring us inline with the ECS spec requiring this field to match event.dataset.

(cherry picked from commit 12df9f7)

Co-authored-by: Andrew Cholakian <andrew@andrewvc.com>
Icedroid pushed a commit to Icedroid/beats that referenced this pull request Nov 1, 2021
This PR fixes the logic behind assigning the data_steam.dataset field.

Previously this was static per monitor type, only the index would change, but not the field. This makes the processor more comprehensive handling not just index naming but field generation.

This is a breaking change, setting event.dataset consistently to the monitor type rather than the old value of uptime. Since this field is unlikely to have been used by anyone the impact is low, and it will bring us inline with the ECS spec requiring this field to match event.dataset.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Heartbeat Team:obs-ds-hosted-services Label for the Observability Hosted Services team v7.15.0
Projects
None yet
4 participants