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

More context on throws #453

Merged
merged 5 commits into from
Dec 8, 2023

Conversation

gregschohn
Copy link
Collaborator

@gregschohn gregschohn commented Nov 17, 2023

Description

Some warning log messages were missing some critical context. I made a sweep through all error/warn messages and added an appropriate amount of context to those that were lacking.

  • Category Maintenance/Diagnostic improvements
  • Why these changes are required? Improve diagnosis.

Testing

unit tests

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…as being dropped.

This can create an error down the line if the underlying implementation changes, even if it works now.
I've also removed a getValue() that didn't do anything.

Signed-off-by: Greg Schohn <[email protected]>
… RequestKey.toString().

Also pass the request key through ParsedHttpMessagesAsDicts so that the request key is present in the (which I've just realized should be sending back optionals or sneaky throws & letting the callers do this conversion... next change).

Signed-off-by: Greg Schohn <[email protected]>
Copy link

codecov bot commented Nov 17, 2023

Codecov Report

Attention: 151 lines in your changes are missing coverage. Please review.

Comparison is base (908f360) 76.86% compared to head (0d9c2f9) 71.16%.

❗ Current head 0d9c2f9 differs from pull request most recent head 84e54b4. Consider uploading reports for the commit 84e54b4 to get more accurate results

Files Patch % Lines
...migrations/replay/kafka/KafkaProtobufConsumer.java 6.25% 135 Missing ⚠️
...h/migrations/replay/ParsedHttpMessagesAsDicts.java 46.66% 2 Missing and 6 partials ⚠️
...y/CapturedTrafficToHttpTransactionAccumulator.java 50.00% 2 Missing ⚠️
.../opensearch/migrations/replay/TrafficReplayer.java 50.00% 2 Missing ⚠️
...y/datahandlers/http/NettyJsonToByteBufHandler.java 0.00% 2 Missing ⚠️
...onditionallyReliableLoggingHttpRequestHandler.java 0.00% 1 Missing ⚠️
...h/migrations/replay/RequestSenderOrchestrator.java 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #453      +/-   ##
============================================
- Coverage     76.86%   71.16%   -5.70%     
+ Complexity     1151     1144       -7     
============================================
  Files           145      121      -24     
  Lines          5887     4890     -997     
  Branches        542      432     -110     
============================================
- Hits           4525     3480    -1045     
- Misses         1080     1138      +58     
+ Partials        282      272      -10     
Flag Coverage Δ
unittests 71.16% <18.37%> (-2.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gregschohn gregschohn marked this pull request as ready for review November 17, 2023 19:21
Signed-off-by: Greg Schohn <[email protected]>

# Conflicts:
#	TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/datatypes/PojoTrafficStreamKey.java
#	TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/kafka/KafkaProtobufConsumer.java
Copy link
Collaborator

@sumobrian sumobrian left a comment

Choose a reason for hiding this comment

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

Minor linting and typo changes should be updated by no need to re-review.

log.warn("Terminating a TrafficStream reconstruction w/out an accumulated value, " +
"assuming an empty server interaction and NOT reproducing this to the target cluster.");
log.atWarn().setMessage("Terminating a TrafficStream reconstruction before data was accumulated " +
"for " + accumulation.trafficChannelKey + "assuming an empty server interaction and NOT " +
Copy link
Collaborator

Choose a reason for hiding this comment

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

add space before 'assuming'.

log.warn("Putting what may be a bogus value in the output because transforming it " +
"into json threw an exception");
// TODO - this isn't a good design choice.
// We should follow through with the spirit of this class and leave thes as empty optional values
Copy link
Collaborator

Choose a reason for hiding this comment

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

thes --> this

@@ -171,7 +172,7 @@ private <T> void scheduleOnConnectionReplaySession(ISourceTrafficChannelKey chan
eventLoop.schedule(task, getDelayFromNowMs(atTime), TimeUnit.MILLISECONDS);
scheduledFuture.addListener(f->{
if (!f.isSuccess()) {
log.atError().setCause(f.cause()).setMessage(()->"Error scheduling task").log();
log.atError().setCause(f.cause()).setMessage(()->"Error scheduling task for "+channelKey).log();
Copy link
Collaborator

Choose a reason for hiding this comment

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

spacing

@@ -922,7 +923,7 @@ private static String formatWorkItem(DiagnosticTrackableCompletableFuture<String
}

public @NonNull CompletableFuture<Void> shutdown(Error error) {
log.warn("Shutting down "+this+" because of "+error);
log.atWarn().setCause(error).setMessage(()->"Shutting down "+this+" because of error").log();
Copy link
Collaborator

Choose a reason for hiding this comment

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

spacing

* block calls to readNextTrafficStreamChunk() until some time window elapses. This
* could be a very large window in cases where there were long gaps between recorded
* requests from the capturing proxy. For example, if a TrafficStream is read and it
* that stream is scheduled to be run one hour later, readNextTrafficStreamChunk()
Copy link
Collaborator

Choose a reason for hiding this comment

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

update: read and if* that stream is scheduled

@gregschohn gregschohn merged commit 44ec296 into opensearch-project:main Dec 8, 2023
5 checks passed
@gregschohn gregschohn deleted the MoreContextOnThrows branch December 8, 2023 15:09
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