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 support for A-api-request-uuid query parameter #807

Merged
merged 15 commits into from
Apr 20, 2024

Conversation

jeffersonwhite
Copy link
Contributor

When the A-api-request-uuid query parameter is included in the request, it will be added to the s3 presigned url so that it can be extracted as a metric when downloaded.

@jeffersonwhite
Copy link
Contributor Author

There's a corresponding rain-api-core change for this:
https://github.com/asfadmin/rain-api-core/pull/292/files

I think I will need to update the commit hashes in the dependency files in the PR once that is merged, to make sure it's getting pulled in here?

@mattp0
Copy link
Contributor

mattp0 commented Apr 12, 2024

@jeffersonwhite Please see the unit test and linter issues.

@jeffersonwhite
Copy link
Contributor Author

I've updated to address the linter findings.

For the unit tests here, they are failing because these changes depend on the changes I have in PR in rain-api-core. I'm not really sure what the process for making changes to both these repos should be, if I understand how things work I could:

  • Update this PR to temporarily point the rain-api-core dependency to the branch of my forked repo so it passes the tests
  • Wait until the rain-api-core PR is merged, and then update the dependency here to point to the new commit

I have run the tests locally to make sure that everything passes when all the changes are present.



def test_get_api_request_uuid():
# Can't use the chalice test client here as it doesn't seem to understand the `{proxy+}` route
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this comment applies because the function being tested is a helper function and not a request handler. You wouldn't be able to test it in isolation with the chalice test client anyway.

Comment on lines 392 to 396
api_request_uuid = None
if query_params is not None:
api_request_uuid = query_params.get("A-api-request-uuid")
if api_request_uuid is not None:
log.info("A-api-request-uuid query param is " + api_request_uuid)
return api_request_uuid
Copy link
Contributor

Choose a reason for hiding this comment

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

api_request_uuid can just be local to the if statement.

Suggested change
api_request_uuid = None
if query_params is not None:
api_request_uuid = query_params.get("A-api-request-uuid")
if api_request_uuid is not None:
log.info("A-api-request-uuid query param is " + api_request_uuid)
return api_request_uuid
if query_params is not None:
api_request_uuid = query_params.get("A-api-request-uuid")
if api_request_uuid is not None:
log.info("A-api-request-uuid query param is " + api_request_uuid)
return api_request_uuid
return None

@reweeden
Copy link
Contributor

* Update this PR to temporarily point the rain-api-core dependency to the branch of my forked repo so it passes the tests

The way I've done it in the past is to point the pinned dependency version to the latest commit hash from my feature branch.

@mattp0
Copy link
Contributor

mattp0 commented Apr 17, 2024

Looks like code cov might of made a change that broke our overage report. I am looking into it. I feel like it should not block your PR here as well. I will discuss with the team

@mattp0 mattp0 force-pushed the api-request-uuid-support branch from 0f0286c to 2c097a1 Compare April 19, 2024 18:00
@mattp0
Copy link
Contributor

mattp0 commented Apr 19, 2024

@jeffersonwhite I got the codecov working. It looks like we just need to add a test or two to cover the cases when query params are None
You can see the report here https://app.codecov.io/gh/asfadmin/thin-egress-app/commit/2c097a10259b1fa61f73766dd03acfff1190892e

@jeffersonwhite
Copy link
Contributor Author

Thanks @mattp0 ! I've updated to cover those cases.

@mattp0 mattp0 requested a review from reweeden April 19, 2024 19:16
@mattp0
Copy link
Contributor

mattp0 commented Apr 20, 2024

@jeffersonwhite Thank you for the contribution! We will start the process of testing and will keep you updated once we have a release cut for TEA.

@mattp0 mattp0 merged commit 4463527 into asfadmin:devel Apr 20, 2024
9 checks passed
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.

4 participants