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]: catch all error handler for browser jobs #30013

Merged

Conversation

vigneshshanmugam
Copy link
Member

@vigneshshanmugam vigneshshanmugam commented Jan 26, 2022

  • fix Inline monitor syntax errors should send errors to ES #29897
  • fix [Heartbeat] Stop appending - inline to monitors #29505
  • Consume all messages both from stderr and stdout from the synthetics runner and add them to synthetics.payload.message. Anything written during the broken journey will be used by Uptime UI for showing debug messages.
  • Introduce suite.* details for all the suite jobs.
  • Wrap all the synthetics browser releated fields in the Synthetics Enricher and drop some of the logic in the global wrapper to make things easier.
  • Gets rid of <monitior>-inline inline suffix from inline monitors.

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jan 26, 2022
@vigneshshanmugam vigneshshanmugam added the Team:obs-ds-hosted-services Label for the Observability Hosted Services team label Jan 26, 2022
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jan 26, 2022
@mergify
Copy link
Contributor

mergify bot commented Jan 26, 2022

This pull request does not have a backport label. Could you fix it @vigneshshanmugam? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Jan 26, 2022
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jan 26, 2022

💚 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

  • Reason: null

  • Start Time: 2022-02-01T01:01:53.556+0000

  • Duration: 77 min 57 sec

  • Commit: c0b4cc0

Test stats 🧪

Test Results
Failed 0
Passed 3307
Skipped 71
Total 3378

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Contributor

@andrewvc andrewvc left a comment

Choose a reason for hiding this comment

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

Leaving a partial review, still reading this completely, lots of good stuff here!

heartbeat/monitors/wrappers/wrappers.go Outdated Show resolved Hide resolved
x-pack/heartbeat/monitors/browser/suite.go Outdated Show resolved Hide resolved
Copy link
Contributor

@andrewvc andrewvc left a comment

Choose a reason for hiding this comment

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

Can we add a test for the behavior of suites when no journey is run? This would test that if the invoked command fails we still generate events with suite metadata etc. even though no journeys are present.

@andrewvc
Copy link
Contributor

Actually, disregard my last comment. In enrich_test.go we can simulate any output we like from a fake invocation of the synthetics command, we should just add a result with something bad happening instead of journeys running.

@vigneshshanmugam vigneshshanmugam marked this pull request as ready for review January 29, 2022 01:37
@vigneshshanmugam vigneshshanmugam requested a review from a team as a code owner January 29, 2022 01:37
@elasticmachine
Copy link
Collaborator

Pinging @elastic/uptime (Team:Uptime)

@vigneshshanmugam vigneshshanmugam added backport-v8.0.0 Automated backport with mergify and removed backport-skip Skip notification from the automated backport with mergify labels Jan 29, 2022
Copy link
Contributor

@andrewvc andrewvc left a comment

Choose a reason for hiding this comment

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

Generally looking good! I want to run some local tests. Also, it looks like you missed my feedback on synthexec.go, when you get a chance could you respond to it?

Nothing there is major, great work on a complex PR!

x-pack/heartbeat/monitors/browser/synthexec/synthexec.go Outdated Show resolved Hide resolved
x-pack/heartbeat/monitors/browser/synthexec/synthexec.go Outdated Show resolved Hide resolved
x-pack/heartbeat/monitors/browser/synthexec/synthexec.go Outdated Show resolved Hide resolved
heartbeat/monitors/wrappers/wrappers.go Show resolved Hide resolved
x-pack/heartbeat/monitors/browser/synthexec/enrich_test.go Outdated Show resolved Hide resolved
},
},
func(t *testing.T, e *beat.Event, je *journeyEnricher) {
v := lookslike.MustCompile(common.MapStr{
Copy link
Contributor

Choose a reason for hiding this comment

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

Would there be any value in also testing the monitor.* values that are set here? Also, as a note, you can use lookslike.Strict to ensure that there are no extra fields if that's appropriate. It just wraps the outer lookslike.MustCompile, but you do have to define every field.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if there would be any value, I added it to denote the case when there are no journeys ran and this was the only message from console.

e.synthEvents <- se
}

e.synthEvents <- se
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a weird thing to consider, which is errors between journeys.

We could still need to check for journey/end to account for errors that might happen between journeys. I think we can just set e.currentJourney.store(false) again, no? Then it just gets reported as an error on the suite.

Our long term goal is for heartbeat to really only execute one journey per monitor (with discovery mode) so I'm OK with not handling this for the moment and just tacking those errors on the previous journey. Also, I don't know what an error between journeys would even be.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure if there would be error between journeys, But with this change we would still get stderr messages on the suite level, wouldnt that be enough to figure out any errors?

@vigneshshanmugam
Copy link
Member Author

vigneshshanmugam commented Jan 31, 2022

Also, it looks like you missed my feedback on synthexec.go, when you get a chance could you respond to it?

Oops, can you point me to that one? Is it about the naming stdSuiteFields? I have already fixed that if thats the case.

Copy link
Contributor

@andrewvc andrewvc left a comment

Choose a reason for hiding this comment

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

LGTM, great work!

@andrewvc
Copy link
Contributor

andrewvc commented Feb 1, 2022

I'm wondering, should we backport this to 7.17.0 , I would say that this is mostly a bugfix, the extra suite stuff won't affect 7.17.0 otherwise

@vigneshshanmugam
Copy link
Member Author

I'm wondering, should we backport this to 7.17.0 , I would say that this is mostly a bugfix, the extra suite stuff won't affect 7.17.0 otherwise

Yeah ++ on back porting it.

@vigneshshanmugam vigneshshanmugam added the backport-7.17 Automated backport to the 7.17 branch with mergify label Feb 1, 2022
@vigneshshanmugam vigneshshanmugam merged commit 267f8cb into elastic:master Feb 1, 2022
mergify bot pushed a commit that referenced this pull request Feb 1, 2022
* [Heartbeat]: catch all error handler for browser jobs

* fix wrapper tests

* add tests and consume all events

* address review and improve test

(cherry picked from commit 267f8cb)
mergify bot pushed a commit that referenced this pull request Feb 1, 2022
* [Heartbeat]: catch all error handler for browser jobs

* fix wrapper tests

* add tests and consume all events

* address review and improve test

(cherry picked from commit 267f8cb)
vigneshshanmugam added a commit that referenced this pull request Feb 1, 2022
* [Heartbeat]: catch all error handler for browser jobs

* fix wrapper tests

* add tests and consume all events

* address review and improve test

(cherry picked from commit 267f8cb)

Co-authored-by: Vignesh Shanmugam <[email protected]>
vigneshshanmugam added a commit that referenced this pull request Feb 1, 2022
* [Heartbeat]: catch all error handler for browser jobs

* fix wrapper tests

* add tests and consume all events

* address review and improve test

(cherry picked from commit 267f8cb)

Co-authored-by: Vignesh Shanmugam <[email protected]>
@vigneshshanmugam vigneshshanmugam added the backport-v8.1.0 Automated backport with mergify label Feb 3, 2022
@elastic elastic deleted a comment from mergify bot Feb 3, 2022
@vigneshshanmugam

This comment was marked as resolved.

@mergify

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-7.17 Automated backport to the 7.17 branch with mergify backport-v8.0.0 Automated backport with mergify backport-v8.1.0 Automated backport with mergify bug Team:obs-ds-hosted-services Label for the Observability Hosted Services team v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inline monitor syntax errors should send errors to ES [Heartbeat] Stop appending - inline to monitors
3 participants