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] Add negative body match #20728

Closed
andrewvc opened this issue Aug 21, 2020 · 6 comments
Closed

[Heartbeat] Add negative body match #20728

andrewvc opened this issue Aug 21, 2020 · 6 comments
Assignees
Labels
enhancement Heartbeat Team:obs-ds-hosted-services Label for the Observability Hosted Services team test-plan Add this PR to be manual test plan v7.11.0

Comments

@andrewvc
Copy link
Contributor

Describe the enhancement:

Today, heartbeat can match bodies using an arbitrary regexp with check.response.body, however this only matches positively. Users might want to perform a negative match as mentioned in this well written forum post.

One thing that makes this tricky is that check.response.body expects a list of strings to match, so extending its syntax is a bit awkward. The best idea I can think of here is to add a new config option, check.response.not_in_body, but that feels awkward too. I'm curious if others have better naming ideas. There is an alternate proposal in the forum post, but it is not valid YAML.

Describe a specific use case for the enhancement or feature:

See the aforementioned forum post, where there are a large number of good values, but one bad value.

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Aug 21, 2020
@andrewvc andrewvc added the Team:obs-ds-hosted-services Label for the Observability Hosted Services team label Aug 21, 2020
@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 21, 2020
@lowryxiao
Copy link
Contributor

Hi Andrew,
I'm the original poster of https://discuss.elastic.co/t/heartbeat-make-http-check-response-body-get-negative-result-based-on-the-match/245332.
Thanks for creating this issue that we can discuss it here.

I'm working on this issue in my local fork too.
Actually, right now I put the new option under check.response as you mentioned too since want it to reverse the checkBody's result.

check.response:
status: 200
body:
- red
reverse_check_body_result: fals

Then all I need to do is to update the checkBody function to add logic to check this option.
Wondering if there any possible I can file a PR to this issue with my code change?

Thanks.

@shahzad31
Copy link
Contributor

@xiaofengmanlou definitely go ahead and open a pr.

@shahzad31
Copy link
Contributor

it would be nice if we can also improve the body mismatch error as mentioned in this issue by me #18765

@lowryxiao
Copy link
Contributor

@shahzad31
Thanks for your suggestion.
Opened a PR. But will need some time to sign contribute agreement.
Maybe I can take a look at your issue once my PR tests is success.

@andrewvc
Copy link
Contributor Author

Resolved in #20746

@andrewvc andrewvc added [zube]: In Progress v7.11.0 test-plan Add this PR to be manual test plan and removed [zube]: Done labels Dec 16, 2020
@zube zube bot added [zube]: Done test-plan Add this PR to be manual test plan and removed [zube]: In Progress test-plan Add this PR to be manual test plan labels Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Heartbeat Team:obs-ds-hosted-services Label for the Observability Hosted Services team test-plan Add this PR to be manual test plan v7.11.0
Projects
None yet
Development

No branches or pull requests

5 participants