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

agent: report fs log errors as http errors #6427

Merged
merged 2 commits into from
Oct 16, 2019
Merged

Commits on Oct 4, 2019

  1. agent: report fs log errors as http errors

    This fixes two bugs:
    
    First, FS Logs API endpoint only propagated error back to user if it was
    encoded with code, which isn't common.  Other errors get suppressed and
    callers get an empty response with 200 error code.  Now, these endpoints
    return  a 500 status code along with the error message.
    
    Before
    ```
    $ curl -v "http://127.0.0.1:4646/v1/client/fs/logs/qwerqwera?follow=false&offset=0&origin=start&region=global&task=redis&type=stdout"; echo
    *   Trying 127.0.0.1...
    * TCP_NODELAY set
    * Connected to 127.0.0.1 (127.0.0.1) port 4646 (#0)
    > GET /v1/client/fs/logs/qwerqwera?follow=false&offset=0&origin=start&region=global&task=redis&type=stdout HTTP/1.1
    > Host: 127.0.0.1:4646
    > User-Agent: curl/7.54.0
    > Accept: */*
    >
    < HTTP/1.1 200 OK
    < Vary: Accept-Encoding
    < Vary: Origin
    < Date: Fri, 04 Oct 2019 19:47:21 GMT
    < Content-Length: 0
    <
    * Connection #0 to host 127.0.0.1 left intact
    ```
    
    After
    ```
    $ curl -v "http://127.0.0.1:4646/v1/client/fs/logs/qwerqwera?follow=false&offset=0&origin=start&region=global&task=redis&type=stdout"; echo
    *   Trying 127.0.0.1...
    * TCP_NODELAY set
    * Connected to 127.0.0.1 (127.0.0.1) port 4646 (#0)
    > GET /v1/client/fs/logs/qwerqwera?follow=false&offset=0&origin=start&region=global&task=redis&type=stdout HTTP/1.1
    > Host: 127.0.0.1:4646
    > User-Agent: curl/7.54.0
    > Accept: */*
    >
    < HTTP/1.1 500 Internal Server Error
    < Vary: Accept-Encoding
    < Vary: Origin
    < Date: Fri, 04 Oct 2019 19:48:12 GMT
    < Content-Length: 60
    < Content-Type: text/plain; charset=utf-8
    <
    * Connection #0 to host 127.0.0.1 left intact
    alloc lookup failed: index error: UUID must be 36 characters
    ```
    
    Second, we return 400 status code for request validation errors.
    
    Before
    ```
    $ curl -v "http://127.0.0.1:4646/v1/client/fs/logs/qwerqwera"; echo
    *   Trying 127.0.0.1...
    * TCP_NODELAY set
    * Connected to 127.0.0.1 (127.0.0.1) port 4646 (#0)
    > GET /v1/client/fs/logs/qwerqwera HTTP/1.1
    > Host: 127.0.0.1:4646
    > User-Agent: curl/7.54.0
    > Accept: */*
    >
    < HTTP/1.1 500 Internal Server Error
    < Vary: Accept-Encoding
    < Vary: Origin
    < Date: Fri, 04 Oct 2019 19:47:29 GMT
    < Content-Length: 22
    < Content-Type: text/plain; charset=utf-8
    <
    * Connection #0 to host 127.0.0.1 left intact
    must provide task name
    ```
    
    After
    ```
    $ curl -v "http://127.0.0.1:4646/v1/client/fs/logs/qwerqwera"; echo
    *   Trying 127.0.0.1...
    * TCP_NODELAY set
    * Connected to 127.0.0.1 (127.0.0.1) port 4646 (#0)
    > GET /v1/client/fs/logs/qwerqwera HTTP/1.1
    > Host: 127.0.0.1:4646
    > User-Agent: curl/7.54.0
    > Accept: */*
    >
    < HTTP/1.1 400 Bad Request
    < Vary: Accept-Encoding
    < Vary: Origin
    < Date: Fri, 04 Oct 2019 19:49:18 GMT
    < Content-Length: 22
    < Content-Type: text/plain; charset=utf-8
    <
    * Connection #0 to host 127.0.0.1 left intact
    must provide task name
    ```
    Mahmood Ali committed Oct 4, 2019
    Configuration menu
    Copy the full SHA
    09ce0e5 View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2019

  1. tests: avoid using unnecessary pipe

    Mahmood Ali committed Oct 15, 2019
    Configuration menu
    Copy the full SHA
    5282353 View commit details
    Browse the repository at this point in the history