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

Set Rails logging context independent of Sentry #20711

Merged
merged 7 commits into from
Feb 18, 2025

Conversation

kayline
Copy link
Contributor

@kayline kayline commented Feb 10, 2025

Summary

  • This work is behind a feature toggle (flipper): NO
  • (Summarize the changes that have been made to the platform)
  • Separate controller concerns for configuring Rails logging context and Sentry logging context. Allow teams not using Sentry to only pull in the Rails logging code.
  • (Which team do you work for, does your team own the maintenance of this component?)
  • Decision Reviews, No. This is shared platform code, but we use it in our module.

Related issue(s)

Testing done

  • New code is covered by unit tests
  • Describe what the old behavior was prior to the change
  • A single method in the SentryControllerLogging concern set both Sentry context and Rails logging context, triggered by a :before filter. Now there are two concerns and two methods, clearly named, and every place that was calling the old one is now calling both. Code that was overriding the old method is now overriding the new name for that method.
  • Describe the steps required to verify your changes are working as expected. Exclusively stating 'Specs run' is NOT acceptable as appropriate testing
  • Ensure logs in datadog retain all their context

What areas of the site does it impact?

(Describe what parts of the site are impacted andifcode touched other areas)
Additional context included in controller logs

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 (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

Copy link

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: app/controllers/concerns/controller_logging_context.rb

@va-vfs-bot va-vfs-bot temporarily deployed to #102065-separate-logging-context/#102065-separate-logging-context/main February 10, 2025 18:12 Inactive
Copy link

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: app/controllers/concerns/controller_logging_context.rb

@va-vfs-bot va-vfs-bot temporarily deployed to #102065-separate-logging-context/#102065-separate-logging-context/main February 10, 2025 18:20 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to #102065-separate-logging-context/#102065-separate-logging-context/main February 10, 2025 18:34 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to #102065-separate-logging-context/#102065-separate-logging-context/main February 10, 2025 18:37 Inactive
dfong-adh
dfong-adh previously approved these changes Feb 11, 2025
@kayline kayline marked this pull request as ready for review February 11, 2025 01:42
@kayline kayline requested review from a team as code owners February 11, 2025 01:42
@kayline kayline requested a review from jmarchi February 11, 2025 01:42
@@ -39,6 +39,7 @@ app/controllers/concerns/instrumentation.rb @department-of-veterans-affairs/va-a
app/controllers/concerns/json_api_pagination_links.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/concerns/mhv_controller_concerns.rb @department-of-veterans-affairs/vfs-health-modernization-initiative @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/concerns/sentry_controller_logging.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/concerns/controller_logging_context.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm on an alphabetization kick recently... would you mind moving this up above line 34 so it's perfectly alphabetized?

The assignment/owner looks right 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

@va-vfs-bot va-vfs-bot temporarily deployed to #102065-separate-logging-context/#102065-separate-logging-context/main February 11, 2025 21:54 Inactive
Copy link
Contributor

@ATeal ATeal left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@rmtolmach
Copy link
Contributor

rmtolmach commented Feb 18, 2025

The final file that needs a review is modules/apps_api/app/controllers/apps_api/application_controller.rb, but that module seems orphaned. So I'll override the need for that review and merge this PR.

@va-vfs-bot va-vfs-bot temporarily deployed to #102065-separate-logging-context/#102065-separate-logging-context/main February 18, 2025 18:16 Inactive
@kayline kayline merged commit 937ffe7 into master Feb 18, 2025
37 of 38 checks passed
@kayline kayline deleted the #102065-separate-logging-context branch February 18, 2025 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants