-
Notifications
You must be signed in to change notification settings - Fork 2
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
Log failed itin checks and bus notifs #263
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Good changes. I have something like the first one in my own repo (a LOG.debug()
line) but I don't check those in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it also worth adding a warning at the top of the method in case the otpResponse
is null?
@@ -301,7 +302,9 @@ private boolean makeOTPRequestAndUpdateMatchingItineraryInternal() { | |||
} | |||
|
|||
// If this point is reached, a matching itinerary was not found | |||
LOG.warn("No comparison itinerary found in otp response for trip"); | |||
LOG.warn("No comparison itinerary found in otp response for trip - params: {}", JsonUtils.toJson(this.trip.otp2QueryParams)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit. this.
is not needed.
@@ -301,7 +302,9 @@ private boolean makeOTPRequestAndUpdateMatchingItineraryInternal() { | |||
} | |||
|
|||
// If this point is reached, a matching itinerary was not found | |||
LOG.warn("No comparison itinerary found in otp response for trip"); | |||
LOG.warn("No comparison itinerary found in otp response for trip - params: {}", JsonUtils.toJson(this.trip.otp2QueryParams)); | |||
LOG.warn("No comparison itinerary found in otp response for trip - saved itinerary: {}", JsonUtils.toJson(this.trip.itinerary)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit. this.
is not needed.
LOG.warn("No comparison itinerary found in otp response for trip"); | ||
LOG.warn("No comparison itinerary found in otp response for trip - params: {}", JsonUtils.toJson(this.trip.otp2QueryParams)); | ||
LOG.warn("No comparison itinerary found in otp response for trip - saved itinerary: {}", JsonUtils.toJson(this.trip.itinerary)); | ||
LOG.warn("No comparison itinerary found in otp response for trip - OTP itineraries: {}", JsonUtils.toJson(otpResponse.plan.itineraries)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this guard against a NPE in case plan is null?
I am also going to add logging for when an itinerary check fails on POSTing a monitored trip. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change approved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, these make sense. (Looked it over, now will look at other PR.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving with a few "nits"!
// (The matching itinerary will replace the original trip.itinerary.) | ||
if ( | ||
ItineraryUtils.occursOnSameServiceDay(itineraryCandidate, otpRequest.dateTime, tripIsArriveBy) && | ||
ItineraryUtils.itinerariesMatch(referenceItinerary, itineraryCandidate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit. Reduce indentation.
// If no match was found for the date, mark day of week as non-existent for the itinerary. | ||
result.handleInvalidDate(otpRequest.dateTime); | ||
|
||
// Log if the itinerary didn't exist "today" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit. Full stop.
|
||
// Log if the itinerary didn't exist "today" | ||
if (index == 1) { | ||
LOG.warn("Itinerary existence check failed 'today' for trip {} - params: {}", trip.id, JsonUtils.toJson(trip.otp2QueryParams)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit. Could this be done in one warning? If not, could Itinerary existence check failed 'today' for trip
be put into a separate String and reused?
@@ -301,7 +305,9 @@ private boolean makeOTPRequestAndUpdateMatchingItineraryInternal() { | |||
} | |||
|
|||
// If this point is reached, a matching itinerary was not found | |||
LOG.warn("No comparison itinerary found in otp response for trip"); | |||
LOG.warn("No comparison itinerary found for trip {} - params: {}", trip.id, JsonUtils.toJson(trip.otp2QueryParams)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit. Similar comment to above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or perhap create a method to control the logging which is called from both places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@binh-dam-ibigroup Looks good now. Thanks.
Checklist
dev
before they can be merged tomaster
)Description
This PR adds logging to track data sent for trip monitoring to OTP and for bus notifications to respective services.