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] Improved redirect support #14125

Merged
merged 10 commits into from
Oct 22, 2019
Merged

Conversation

andrewvc
Copy link
Contributor

@andrewvc andrewvc commented Oct 18, 2019

This patch better handles redirects in heartbeat. It takes a different tack than what was described in #13146 . This PR is on the whole more pragmatic, accomplishing substantive change with undue complication of the schema and beats codebase.

Changes in this patch:

  • Added http.response.redirects field. This is an array of URLs redirected to inclusive of the final destination, exclusive of the original URL.
  • Utilize the host codepath, rather than the IP codepath for execution of the check, previously only used for proxies in heartbeat, for redirects. This simplifies the code, hides timing data that can be screwy with redirects (things like fine grained DNS resolution). This means that the following fields no longer appear with redirects enabled in the event: http.rtt.content.us, http.rtt.response_header.us, http.rtt.total.us, http.rtt.validate.us, http.rtt.write_request.us.
  • Default max_redirects: 0 instead of 10

The new default does make this a breaking change, however, we either need to break that setting and preserve the timing information for the common use case of someone checking a non-redirecting URL, or keeping it at 10 but losing the timing info. The third option would be to invest additional eng. effort here to track those numbers across reqs, but the benefit seems, minimal given that they are not displayed in the UI, only in dashboards.

@andrewvc andrewvc added bug enhancement Heartbeat Team:obs-ds-hosted-services Label for the Observability Hosted Services team labels Oct 18, 2019
@andrewvc andrewvc requested a review from a team as a code owner October 18, 2019 01:45
@andrewvc andrewvc self-assigned this Oct 18, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/uptime (:uptime)

@andrewvc andrewvc added [zube]: In Progress in progress Pull request is currently in progress. labels Oct 18, 2019
Copy link
Collaborator

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

Code LGTM.

The thing that took me a while to understand is what exactly an event with 2 redirects looks like

  • with the code today
  • with the changed code and redirects set to 0
  • with the changed code and redirects set to 10

It would be nice if we do a breaking change (which sounds reasonable here) to at least have it super easy for users to understand how their event structure will exactly change with an example.

@andrewvc
Copy link
Contributor Author

@ruflin Thanks for the review! I've updated the PR description to include the full list of removed fields when HTTP redirects are enabled.

@ruflin
Copy link
Collaborator

ruflin commented Oct 22, 2019

@andrewvc I was actually thinking of documentation for our users, something like https://www.elastic.co/guide/en/beats/libbeat/current/breaking-changes-7.4.html

@andrewvc andrewvc merged commit 694dac8 into elastic:master Oct 22, 2019
@andrewvc andrewvc deleted the better-redirects branch October 22, 2019 19:10
@ruflin
Copy link
Collaborator

ruflin commented Oct 23, 2019

@andrewvc Not sure if you saw my last comment here: #14125 (comment) I think this is still needed in a follow up PR.

@andrewvc
Copy link
Contributor Author

@ruflin ah, I missed it, will add.

andrewvc added a commit to andrewvc/beats that referenced this pull request Jan 29, 2020
This patch better handles redirects in heartbeat. It takes a different tack than what was described in elastic#13146 . This PR is on the whole more pragmatic, accomplishing substantive change with undue complication of the schema and beats codebase.

Changes in this patch:

* Added http.response.redirects field. This is an array of URLs redirected to inclusive of the final destination, exclusive of the original
* Utilize the host codepath, rather than the IP codepath for execution of the check, previously only used for proxies in heartbeat, for redirects. This simplifies the code, hides timing data that can be screwy with redirects (things like fine grained DNS resolution). This means that the following fields no longer appear with redirects enabled in the event: http.rtt.content.us, http.rtt.response_header.us, http.rtt.total.us, http.rtt.validate.us, http.rtt.write_request.us.
* Default max_redirects: 0 instead of 10

The new default does make this a breaking change, however, we either need to break that setting and preserve the timing information for the common use case of someone checking a non-redirecting URL, or keeping it at 10 but losing the timing info. The third option would be to invest additional eng. effort here to track those numbers across reqs, but the benefit seems, minimal given that they are not displayed in the UI, only in dashboards.

(cherry picked from commit 694dac8)
jorgemarey pushed a commit to jorgemarey/beats that referenced this pull request Jun 8, 2020
This patch better handles redirects in heartbeat. It takes a different tack than what was described in elastic#13146 . This PR is on the whole more pragmatic, accomplishing substantive change with undue complication of the schema and beats codebase.

Changes in this patch:

* Added http.response.redirects field. This is an array of URLs redirected to inclusive of the final destination, exclusive of the original 
* Utilize the host codepath, rather than the IP codepath for execution of the check, previously only used for proxies in heartbeat, for redirects. This simplifies the code, hides timing data that can be screwy with redirects (things like fine grained DNS resolution). This means that the following fields no longer appear with redirects enabled in the event: http.rtt.content.us, http.rtt.response_header.us, http.rtt.total.us, http.rtt.validate.us, http.rtt.write_request.us.
* Default max_redirects: 0 instead of 10

The new default does make this a breaking change, however, we either need to break that setting and preserve the timing information for the common use case of someone checking a non-redirecting URL, or keeping it at 10 but losing the timing info. The third option would be to invest additional eng. effort here to track those numbers across reqs, but the benefit seems, minimal given that they are not displayed in the UI, only in dashboards.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants