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

5310 remove logging low hanging fruit #12755

Merged
merged 0 commits into from
May 22, 2023

Conversation

kpethtel
Copy link
Contributor

@kpethtel kpethtel commented May 22, 2023

Summary

  • Removes unnecessary logging within the mobile module
  • For more details, see this draft PR. https://github.com/department-of-veterans-affairs/vets-api/pull/12734/files#
    That branch includes notes on all logging in the mobile module and the PR includes categories and actions.
  • For this ticket, I searched datadog for all of our logging and tried to determine whether it was used and whether it was useful. Nearly all of it was either unused or unhelpful.

Related issue(s)

department-of-veterans-affairs/va-mobile-app#5310

Testing done

Specs.

Screenshots

Note: Optional

What areas of the site does it impact?

(Describe what parts of the site are impacted andifcode touched other areas)

Acceptance criteria

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No error nor warning in the console.
  • Events are being sent to the appropriate logging solution
  • Documentation has been updated (link to documentation)
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Feature/bug has a monitor built into Datadog or Grafana (if applicable)
  • If app impacted requires authentication, did you login to a local build and verify all authenticated routes work as expected
  • I added a screenshot of the developed feature

Requested Feedback

Please let me know if any of this logging is worth keeping or if the removal is complex enough to merit a separate PR.

@kpethtel kpethtel requested review from a team as code owners May 22, 2023 16:42
@@ -40,14 +40,6 @@ def validate
))
end

# No domestic or military addresses should have a province but some have been coming in as a string 'null'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is no longer happening. Pretty sure the bug is resolved.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this was happening very infrequently in production but we brought it to the upstream team and it was a small enough issue and required a big enough fix that it wasn't deemed worth doing. so no point in logging it anymore.

@github-actions
Copy link

1 Warning
⚠️ This PR changes 354 LoC (not counting whitespace/newlines).

In order to ensure each PR receives the proper attention it deserves, we recommend not exceeding
200. Expect some delays getting reviews.

File Summary

Files

  • modules/mobile/app/controllers/mobile/v0/addresses_controller.rb (+0/-8)

  • modules/mobile/app/controllers/mobile/v0/appointments_controller.rb (+0/-9)

  • modules/mobile/app/controllers/mobile/v0/community_care_eligibility_controller.rb (+0/-2)

  • modules/mobile/app/controllers/mobile/v0/community_care_providers_controller.rb (+1/-2)

  • modules/mobile/app/controllers/mobile/v0/facilities_info_controller.rb (+0/-2)

  • modules/mobile/app/controllers/mobile/v0/facility_eligibility_controller.rb (+0/-3)

  • modules/mobile/app/controllers/mobile/v0/messages_controller.rb (+0/-1)

  • modules/mobile/app/controllers/mobile/v0/payment_history_controller.rb (+0/-10)

  • modules/mobile/app/controllers/mobile/v0/prescriptions_controller.rb (+1/-44)

  • modules/mobile/app/controllers/mobile/v0/push_notifications_controller.rb (+0/-4)

  • modules/mobile/app/controllers/mobile/v0/veterans_affairs_eligibility_controller.rb (+0/-2)

  • modules/mobile/app/controllers/mobile/v1/immunizations_controller.rb (+1/-4)

  • modules/mobile/app/helpers/mobile/appointments_cache_interface.rb (+2/-17)

  • modules/mobile/app/helpers/mobile/facilities_helper.rb (+0/-4)

  • modules/mobile/app/models/mobile/v0/adapters/appointment_requests.rb (+0/-6)

  • modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb (+11/-9)

  • modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointments.rb (+0/-6)

  • modules/mobile/app/models/mobile/v0/templates/base_appointment.rb (+1/-4)

  • modules/mobile/app/models/mobile/v0/templates/community_care_appointment.rb (+0/-7)

  • modules/mobile/app/models/mobile/v0/templates/va_appointment.rb (+0/-7)

  • modules/mobile/app/serializers/mobile/v0/user_serializer.rb (+1/-15)

  • modules/mobile/app/services/mobile/v0/claims/proxy.rb (+1/-13)

  • modules/mobile/app/services/mobile/v0/disability_rating/proxy.rb (+1/-13)

  • modules/mobile/app/services/mobile/v0/lighthouse_health/service.rb (+2/-1)

  • modules/mobile/app/services/mobile/v2/appointments/presentation_filter.rb (+2/-12)

  • modules/mobile/app/services/mobile/v2/appointments/provider_names.rb (+0/-5)

  • modules/mobile/app/workers/mobile/v0/pre_cache_appointments_job.rb (+1/-9)

  • modules/mobile/app/workers/mobile/v0/pre_cache_claims_and_appeals_job.rb (+0/-1)

  • modules/mobile/spec/models/adapters/appointment_requests_adapter_spec.rb (+2/-9)

  • modules/mobile/spec/request/appointments_vaos_v2_list_request_spec.rb (+2/-4)

  • modules/mobile/spec/request/claims_and_appeals_overview_request_spec.rb (+0/-55)

  • modules/mobile/spec/request/community_care_eligibility_request_spec.rb (+0/-6)

  • modules/mobile/spec/request/user_request_spec.rb (+0/-3)

  • modules/mobile/spec/request/v1/user_request_spec.rb (+0/-10)

  • modules/mobile/spec/services/v2/appointments/presentation_filter_spec.rb (+0/-12)

  • modules/mobile/spec/services/v2/appointments/provider_names_spec.rb (+2/-4)

    Note: We exclude files matching the following when considering PR size:

    *.csv, *.json, *.tsv, *.txt, Gemfile.lock, app/swagger, modules/mobile/docs, spec/fixtures/, spec/support/vcr_cassettes/, modules/mobile/spec/support/vcr_cassettes/, db/seeds, modules/vaos/app/docs, modules/meb_api/app/docs, modules/appeals_api/app/swagger/
    

Big PRs are difficult to review, often become stale, and cause delays.

Generated by 🚫 Danger

@@ -35,10 +35,6 @@ def adapter

def bgs_service_response
person = BGS::People::Request.new.find_person_by_participant_id(user: current_user)
if person.response.blank?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This logging actually did incidentally reveal a minor bug with id.me that sometimes results in users not having ICNs. The identity team is now aware of it.

begin
resource = client.get_history_rxs

# Temporary logging for prescription bug investigation
Copy link
Contributor Author

@kpethtel kpethtel May 22, 2023

Choose a reason for hiding this comment

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

This was already commented out due to performance issues.

Copy link
Contributor

@jperk51 jperk51 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -19,12 +19,6 @@ def parse(requests)
else
va_appointments << Templates::VAAppointment.new(request).appointment
end
rescue => e
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think these rescues were valuable when we created them because we didn't want these endpoints to be unstable due to us making adapter errors. But I don't see any instances of these errors, so I think we're safe now to remove the guardrails and let the request fail. Those errors will show in sentry which will alert us faster than logging.

@@ -345,19 +343,23 @@ def parse_phone(phone)
# and optional extension (until the end of the string) (?:\sx(\d*))?$
phone_captures = phone&.match(/^\(?(\d{3})\)?.?(\d{3})-?(\d{4})(?:\sx(\d*))?$/)

Copy link
Contributor Author

@kpethtel kpethtel May 22, 2023

Choose a reason for hiding this comment

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

This error was happening, but I believe it was only happening because the phone number was nil. I've changed the logic to only log if the phone number is present but phone captures are nil, which would imply that our regex capture failed. Please ensure that my logic here is correct.

@@ -120,9 +108,7 @@ def authorized_services

def direct_deposit_update_access?
user.authorize(:ppiu, :access_update?)
rescue => e
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem with logging this is that the error is almost always a timeout or backend service error. It's not helpful information.

@@ -32,7 +32,8 @@ def get_immunizations
#
def get_location(id)
response = perform(:get, "Location/#{id}", nil, headers)
Rails.logger.info('Mobile Lighthouse Service, Location response', response:)
# remove this logging later. it doesn't have any lasting value.
Rails.logger.info('Mobile Lighthouse Service, Location response', response_body: response.body)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've kept this for now because I was not seeing the logging but I was seeing all of the logging around it. That puzzled me. I suspect it's because the response is too much data to log, so I'm trying to log less data. Once this is confirmed, I can remove this altogether.

@@ -17,10 +17,6 @@ def initialize(user)
end

def form_names_from_appointment_practitioners_list(practitioners_list)
unless practitioners_list.class.in?([Array, NilClass])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This wasn't happening.

@@ -52,8 +51,8 @@ def coordinates
Mobile::FacilitiesHelper.user_address_coordinates(@current_user)
end

# this doesn't appear to be in active use, presumably because the FE doesn't send the facility id
Copy link
Contributor

Choose a reason for hiding this comment

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

this is for appt scheduling which didn't make the cut atm for the app so makes sense it's not being called. it will get called if scheduling does get used though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The logging above CC providers call start is being logged, so it does seem to be in use somehow. I assume you mean the front end doesn't send facility id because that was only needed for appt scheduling.

Copy link
Contributor

Choose a reason for hiding this comment

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

could that logging be coming from the backend mobile tester?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you're right. I assumed I was looking at prod but all of these are for staging.

@kpethtel kpethtel merged commit dcc2bf1 into master May 22, 2023
@kpethtel kpethtel deleted the 5310-remove-logging-low-hanging-fruit branch May 22, 2023 20:55
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.

5 participants