Fixing intermittent panic on metric submission #92
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In certain (unknown) cases, submitting metrics via the Datadog API fails with the error
EOF
and anil
http response. It appears that while the Datadog API config has aCompress
field, setting it totrue
does not actually enable compression. It only prevents it from disabling compression:Despite the Datadog client indicating the gzip compression is on by default, an inspection of the code and dumping the request indicates that it is not. Manually setting the content encoding on each request is required to actually enable compression.
In some case the lack of compression caused a failure in the underlying http client which resulted in an
EOF
error. It's unclear what payload size or conditions resulted in this issue, but adding the content encoding resolved the issue.gzip
whencompress
is set totrue
nil
check on the http response to prevent trying to get the status code from it when it isnil