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

DebugInformation property on responses and exceptions #1797

Merged
merged 3 commits into from
Feb 4, 2016

Conversation

Mpdreamz
Copy link
Member

@Mpdreamz Mpdreamz commented Feb 3, 2016

This PR adds a .DebugInformation property on responses & exceptions which acts as the goto diagnosis tool both for devs using NEST and for us maintainers to ask for when we receive a bug report.

Examples

Valid response

Valid NEST response built from a succesful low level call on POST: /project/project/nest-92a78d48/_update?pretty=true&fields=name%2C_source
# Audit trail of this API call:
 - HealthyResponse: Node: http://ipv4.fiddler:9200/ Took: 00:00:00.0105188
# Request :
<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
# Response :
<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>

Invalid response from a healthy low level call:

Individual responses can explain why they marked the response as functionally invalid, e.g here the bulkresponse lists the failed responses

Invalid NEST response built from a succesful low level call on POST: /nest-311ded48/_bulk?pretty=true
operation[0]: update returned 404 _index: nest-311ded48 _type: project _id: Turcotte - Langworth _version: 0 error: Type: document_missing_exception Reason: "[project][Turcotte - Langworth]: document missing"
# Audit trail of this API call:
 - HealthyResponse: Node: http://ipv4.fiddler:9200/ Took: 00:00:00.9404774
# Request :
<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
# Response :
<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>

Response with exception caught:

Invalid NEST response built from a unsuccesful low level call on GET: /doesntexist/_mapping/project
# Audit trail of this API call:
 - BadResponse: Node: http://ipv4.fiddler:9200/ Took: 00:00:02.0921637
# ServerError: ServerError: 404Type: index_not_found_exception Reason: "no such index"
# OriginalException: System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.GetResponse()
   at Elasticsearch.Net.HttpConnection.Request[TReturn](RequestData requestData) in C:\Users\Mpdreamz\dev\elastic\coreclr\src\Elasticsearch.Net\Connection\HttpConnection.cs:line 138
# Request :
<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
# Response :
<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>

Exception

# FailureReason: BadResponse when trying to GET http://ipv4.fiddler:9200/doesntexist/_mapping/project
# Audit trail of this API call:
 - BadResponse: Node: http://ipv4.fiddler:9200/ Took: 00:00:02.0759486
# ServerError: ServerError: 404Type: index_not_found_exception Reason: "no such index"
# OriginalException: System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.GetResponse()
   at Elasticsearch.Net.HttpConnection.Request[TReturn](RequestData requestData) in C:\Users\Mpdreamz\dev\elastic\coreclr\src\Elasticsearch.Net\Connection\HttpConnection.cs:line 138
# Request :
<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
# Response :
<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
# Inner Exception: The remote server returned an error: (404) Not Found.
System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.GetResponse()
   at Elasticsearch.Net.HttpConnection.Request[TReturn](RequestData requestData) in C:\Users\Mpdreamz\dev\elastic\coreclr\src\Elasticsearch.Net\Connection\HttpConnection.cs:line 138
# Exception:
<stracktrace_trimmed>

Interesting audit trail exception:

This one is from our virtual clustering tests that throws hard Exception's

# FailureReason: Unexpected when trying to POST http://localhost:9201/_search
 - PingFailure: Node: http://localhost:9200/ Exception: Exception Took: 00:00:00
 - PingSuccess: Node: http://localhost:9201/ Took: 00:00:00
 - BadResponse: Node: http://localhost:9201/ Exception: Exception Took: 00:00:00
# Audit exception in step 0 PingFailure:
System.Exception: ping exception
<snip>
# Audit exception in step 1 BadResponse:
System.Exception: boom!
   at Tests.Framework.VirtualClusterConnection.<>c__13`2.<Fail>b__13_0(Exception e) in <snip>
# Inner Exception: boom!
System.Exception: boom!
   at Tests.Framework.VirtualClusterConnection.<>c__13`2.<Fail>b__13_0(Exception e) in <snip>

@russcam
Copy link
Contributor

russcam commented Feb 4, 2016

LGTM 👍

@Mpdreamz Mpdreamz merged commit ed514ec into master Feb 4, 2016
@Mpdreamz Mpdreamz deleted the feature/debug-information branch February 4, 2016 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants