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

Add platform info to access logging only in Backsplash #5638

Merged
merged 9 commits into from
Jan 5, 2022

Conversation

aaronxsu
Copy link
Member

@aaronxsu aaronxsu commented Dec 27, 2021

Overview

This PR:

  • adds a new case class UserWithPlatform which has platformId and platformName in addition to user fields
  • adds dao methods to get the most recently attached platform information by user ID
  • updates authenticators and caches in backsplash so that they use the above dao method to grab user platform along with basic user info
  • adds a utility method in backsplash to attach info from UserWithPlatform with response headers
  • updates all backsplash endpoints to call the above utility method before returning
  • updates the AccessLoggingMiddleware so that it reads from the above updated header info, adds platform name and ID to the access logs, and delete the added headers before returning the response

Checklist

  • Description of PR is in an appropriate section of the changelog and grouped with similar changes if possible
  • New tables and queries have appropriate indices added
  • Any content changes are properly templated using BUILDCONFIG.APP_NAME
  • Any new SQL strings have tests
  • Any new endpoints have scope validation and are included in the integration test csv

Testing Instructions

  • A test/asu/add-platId-to-access-logging branch was pushed to staging, so the current staging backsplash should already ship platform information along with existing access logs to Cloudwatch
  • If staging was overwritten, push a test branch again to test it on staging and Cloudwatch, since this should be the easiest way to test
  • Go to https://develop--raster-foundry-annotate.netlify.app/app, log in with your Azavea Google account
  • Create a campaign, or ask me to share a campaign with you
  • Browse the project images in the campaign which will generate some requests to backsplash
  • Go to AWS console, log in with your RF IAM user account, go to Cloudwatch, go to Log Insights, select the logStagingBacksplash log group, set the timeframe as the last 1 hour, and run the following query. It should give you some results that contain platform info in the access logs
fields @timestamp, @message
| sort @timestamp desc
| filter @message like /.*raster-io.*/
| parse '"platformId":*,' as platformId
| parse '"platformName":*,' as platformName
| filter ispresent(platformId) and ispresent(platformName)

Closes https://github.com/azavea/raster-foundry-platform/issues/1370

Copy link
Contributor

@pomadchin pomadchin left a comment

Choose a reason for hiding this comment

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

🚀 LGTM 🚀 nice

@aaronxsu aaronxsu merged commit b5982be into develop Jan 5, 2022
@aaronxsu aaronxsu deleted the feature/asu/add-platId-to-access-logging branch January 5, 2022 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants