Skip to content

Always include purposefully-written messages for severe error cases#187

Merged
FlorianVeaux merged 2 commits into
masterfrom
fm/more-logs
Mar 24, 2021
Merged

Always include purposefully-written messages for severe error cases#187
FlorianVeaux merged 2 commits into
masterfrom
fm/more-logs

Conversation

@florimondmanca

Copy link
Copy Markdown
Contributor

What does this PR do?

Update usages of DatadogUtilities.severe(...) so that in each case we provide a purposefully written error message. This avoids users getting an unhelpful "An unexpected error occurred", and should help move forward some support cases.

Description of the Change

Update all usages of DatadogUtilities.severe(...). None should be passing message: null anymore — please check.

(I haven't updated the implementation of severe() to disallow passing null yet, I think we can treat that as a follow-up if necessary.)

Alternate Designs

Possible Drawbacks

Verification Process

Additional Notes

Release Notes

Review checklist (to be filled by reviewers)

  • Feature or bug fix MUST have appropriate tests (unit, integration, etc...)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have one changelog/ label attached. If applicable it should have the backward-incompatible label attached.
  • PR should not have do-not-merge/ label attached.
  • If Applicable, issue must have kind/ and severity/ labels attached at least.

@florimondmanca florimondmanca added the changelog/Added Added features results into a minor version bump label Mar 4, 2021
FlorianVeaux
FlorianVeaux previously approved these changes Mar 4, 2021

@FlorianVeaux FlorianVeaux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ! 💯

StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
logger.finer(message + ": " + sw.toString());
logger.warning(message + ": " + sw.toString());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually I will remove this from the PR since it's unrelated, but:

A customer running on 2.8.1 mentioned that they were only seeing "An unexpected error occurred", but no other information — in particular, no stack trace. I wonder if it's because FINER level logs may not show up in all situations?

Should we change the log level here so that stack traces always show up?

Interestingly there's no logger.error(), so logger.warning() is the closest log level, but I believe it could still be disabled in practice. WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we try with warning instead of finer and verify that the stack trace does show up?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This is independent of the detailed error messages though so I've dropped it from this PR and will submit something separately.

@florimondmanca

Copy link
Copy Markdown
Contributor Author

@FlorianVeaux Thanks, think I still have to get CI in check and remove that logger.warning() change for a separate PR. :)

@FlorianVeaux

Copy link
Copy Markdown
Contributor

Are tests failing locally? Seems like the jenkins CI is unable to checkout the repo 🤷

mgarabed
mgarabed previously approved these changes Mar 4, 2021

@mgarabed mgarabed left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great - having the unique messages will definitely help troubleshooting errors! 💯

@florimondmanca
florimondmanca dismissed stale reviews from mgarabed and FlorianVeaux via 2307aff March 4, 2021 15:06
@florimondmanca
florimondmanca marked this pull request as ready for review March 4, 2021 15:06
@florimondmanca

Copy link
Copy Markdown
Contributor Author

Remaining checkout issue in the linux-8 build seems unrelated?

https://ci.jenkins.io/blue/organizations/jenkins/Plugins%2Fdatadog-plugin/detail/PR-187/2/pipeline/

[2021-03-04T15:19:57.379Z] EC2 (aws) - Ubuntu 18.04 LTS (i-04749efff146ad779) was marked offline: Connection was broken: java.io.EOFException

@FlorianVeaux
FlorianVeaux merged commit 24d86c5 into master Mar 24, 2021
@FlorianVeaux
FlorianVeaux deleted the fm/more-logs branch March 24, 2021 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/Added Added features results into a minor version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants