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

JSON Checks for Heartbeat HTTP Monitors #8667

Merged
merged 3 commits into from
Nov 9, 2018
Merged

Commits on Oct 26, 2018

  1. [Heartbeat] Read entire body before closing connection

    This fixes an issue where the connection would be closed after only a partial body read. The RoundTripper would close the conn before returning the response which included a partially buffered body. This would actually work for short responses, since the backing bufio would do a partial read, but would fail on all but the shortest responses.
    
    Normally connection lifecycle is handled outside the realm of the `RoundTripper`, but for our purposes we don't want to re-use connections. Since it is a requirement that all response bodies be closed, we can piggy-back on top of that to ensure the connection is closed.
    
    Fixes elastic#8588
    andrewvc committed Oct 26, 2018
    Configuration menu
    Copy the full SHA
    bbefa87 View commit details
    Browse the repository at this point in the history
  2. Add JSON body check support to Heartbeat

    This commit adds a new `json` check for HTTP responses letting users define an arbitrary condition to match against parsed JSON to determine whether an endpoint is up or down.
    
    The nice thing about structured checks like this is that it makes it easy for users to precisely piggy-back on top of existing JSON endpoints, or write their own where a given key/value could indicate the health of an external system. In a sense, it allows users to write a healthcheck endpoint.
    
    An example can be seen below:
    
    ```yaml
    heartbeat.monitors:
    - type: http
      # List or urls to query
      urls: ["http://localhost:9200"]
      schedule: '@every 10s'
      check.response.json:
        - description: check version
          condition: equals.version.number: "6.4.0"
    ```
    andrewvc committed Oct 26, 2018
    Configuration menu
    Copy the full SHA
    507f678 View commit details
    Browse the repository at this point in the history

Commits on Oct 29, 2018

  1. Remove accidental comment

    andrewvc committed Oct 29, 2018
    Configuration menu
    Copy the full SHA
    1d11a6b View commit details
    Browse the repository at this point in the history