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

jsonclient: log client URI when logging errors #617

Merged
merged 2 commits into from Nov 20, 2019

Conversation

cpu
Copy link
Contributor

@cpu cpu commented Nov 19, 2019

When dependent software manages submission to several logs by creating multiple LogClient instances the error messages logged by the underlying JSONClient need to identify the URI at fault or they don't have enough context to stand-alone. E.g. If a LogClient fails an initial submission to a log but will retry after a period a line like the following is logged:

Request failed, backing-off for 8.032332341s: got HTTP status 503 Service Temporarily Unavailable

Without more context it's difficult to determine which log returned a 503 prompting a backed-off retry.

Prior to this PR JSONClient.PostAndParseWithRetry logged the underlying URI in one error logging site but not two others, including the bad status code case shared above. This PR adds the URI to the other two sites and adjusts the wording of the existing site to be consistent.

Checklist

Daniel added 2 commits November 19, 2019 13:58
When dependent software manages submission to several logs by creating
multiple LogClient instances the error messages logged by the underlying
JSONClient need to identify the URI at fault. Otherwise messages like
the following are written to the logger:

```
Request failed, backing-off for 8.032332341s: got HTTP status 503 Service Temporarily Unavailable
```

Without more context it's difficult to determine _which_ log returned
a 503.

Prior to this commit `JSONClient.PostAndParseWithRetry` logged the
underlying URI in one error logging site but not two others, including
the bad status code case shared above.
@cpu cpu changed the title Cpu log jsonclient uri jsonclient: log client URI when logging errors Nov 19, 2019
@codecov
Copy link

codecov bot commented Nov 19, 2019

Codecov Report

Merging #617 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #617   +/-   ##
=======================================
  Coverage   71.77%   71.77%           
=======================================
  Files          90       90           
  Lines        9801     9801           
=======================================
  Hits         7035     7035           
  Misses       2273     2273           
  Partials      493      493
Impacted Files Coverage Δ
jsonclient/client.go 95.58% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b121be8...8511526. Read the comment docs.

@Martin2112 Martin2112 merged commit 4506a87 into google:master Nov 20, 2019
@cpu cpu deleted the cpu-log-jsonclient-uri branch November 20, 2019 15:21
@cpu
Copy link
Contributor Author

cpu commented Nov 20, 2019

Thanks @Martin2112!

zorawar87 pushed a commit to n-ct/certificate-transparency-go that referenced this pull request Mar 1, 2020
* jsonclient: log client URI when logging errors.

When dependent software manages submission to several logs by creating
multiple LogClient instances the error messages logged by the underlying
JSONClient need to identify the URI at fault. Otherwise messages like
the following are written to the logger:

```
Request failed, backing-off for 8.032332341s: got HTTP status 503 Service Temporarily Unavailable
```

Without more context it's difficult to determine _which_ log returned
a 503.

Prior to this commit `JSONClient.PostAndParseWithRetry` logged the
underlying URI in one error logging site but not two others, including
the bad status code case shared above.

* CHANGELOG: add JSONClient logging diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants