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 API request logging #500

Merged
merged 6 commits into from
Jul 27, 2023
Merged

Add API request logging #500

merged 6 commits into from
Jul 27, 2023

Conversation

mrchrisadams
Copy link
Member

@mrchrisadams mrchrisadams commented Jul 27, 2023

This PR introduces API request logging using the DRF API logger project, for logging the API requests providers and people implementing carbon.txt are likely to make.

There are two tests, but by default our test suite does not exercise these tests. This is because DRF API logger works by running a thread in the background, and to spin it up you need to run use the live_server fixture for django pytest.

The thing is, live server works by running, and then running tests in its own separate thread, which means that two tests that use the live_server fixture can end up influencing each other.

You can run the tests separately using this invocation, but right now, this isn't part of our CI action, as it would likely add at least a minute to the test and we are mainly testing config.

pipenv run pytest apps/greencheck/tests/test_api_logger.py -m uses_separate_logging_thread

@mrchrisadams mrchrisadams merged commit d1ae2c1 into master Jul 27, 2023
1 check passed
@hanopcan hanopcan deleted the ca-card-220-api-req-logging branch September 20, 2023 14:18
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.

1 participant