Ensure Kibana client reconnects.#2421
Conversation
Implement Kibana client wrapper that takes care of obtaining a valid Kibana client, in case client cannot be obtained on startup. fixes elastic#2371
graphaelli
left a comment
There was a problem hiding this comment.
This is great, kibana connection was reestablished after being broken as expected. Some strange response bodies though:
kibana stopped after start:
$ curl -H 'Accept: */*' -i http://localhost:8200/config/v1/agents?service.name=foo
HTTP/1.1 503 Service Unavailable
Cache-Control: max-age=300, must-revalidate
Content-Type: application/json
X-Content-Type-Options: nosniff
Date: Wed, 10 Jul 2019 20:06:08 GMT
Content-Length: 35
"sending request to kibana failed"
kibana partially up - Kibana server is not ready yet
$ curl -H 'Accept: */*' -i http://localhost:8200/config/v1/agents?service.name=foo
HTTP/1.1 503 Service Unavailable
Cache-Control: max-age=300, must-revalidate
Content-Type: application/json
X-Content-Type-Options: nosniff
Date: Wed, 10 Jul 2019 20:06:15 GMT
Content-Length: 3
""
no config available:
$ curl -H 'Accept: */*' -i http://localhost:8200/config/v1/agents?service.name=foo
HTTP/1.1 404 Not Found
Cache-Control: max-age=300, must-revalidate
Content-Type: application/json
X-Content-Type-Options: nosniff
Date: Wed, 10 Jul 2019 20:06:50 GMT
Content-Length: 22
"no config found for"
Those double quoted, non json bodies don't seem right, or is that what we agreed upon for now?
| if err != nil { | ||
| b = []byte(fmt.Sprintf("%+v", body)) | ||
| } | ||
| b = append(b, "\n"...) |
There was a problem hiding this comment.
not for now, but we should see if it's worth avoiding creation of b and write directly instead
|
|
||
| var ( | ||
| mockCfg = common.MustNewConfigFrom(`{"enabled": "false", "host": "non-existing"}`) | ||
| mockBody = ioutil.NopCloser(convert.ToReader(`{"response": "ok"}`)) |
There was a problem hiding this comment.
this is the first I've seen ToReader - it should probably just return a ioutil.NopCloser since we're wrapping that everywhere it's used.
There was a problem hiding this comment.
I only moved this, so didn't check in detail. But there are other places where we don't wrap it e.g. agentcfg/fetch.go#L63.
That's actually the same behavior in |
Implement Kibana client wrapper that takes care of obtaining a valid Kibana client, in case client cannot be obtained on startup. Align returned response body to whether or not the user sends a secret token. Log full error messages. fixes elastic#2371
Implement Kibana client wrapper that takes care of obtaining a valid Kibana client, in case client cannot be obtained on startup. Align returned response body to whether or not the user sends a secret token. Log full error messages. fixes elastic#2371
Implement Kibana client wrapper that takes care of obtaining a valid Kibana client, in case client cannot be obtained on startup. Align returned response body to whether or not the user sends a secret token. Log full error messages. fixes elastic#2371
Implement Kibana client wrapper that takes care of obtaining a valid Kibana client, in case client cannot be obtained on startup. Align returned response body to whether or not the user sends a secret token. Log full error messages. fixes #2371
Implement Kibana client wrapper that takes care of obtaining a valid Kibana client, in case client cannot be obtained on startup. Align returned response body to whether or not the user sends a secret token. Log full error messages. fixes #2371
Implement Kibana client wrapper that takes care of obtaining a valid
Kibana client, in case client cannot be obtained on startup.
Align returned response body to whether or not the user sends a secret token.
Log full error messages.
fixes #2371