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

fix(emqx_management): delete files after trace log download #9781

Merged
merged 4 commits into from Jan 18, 2023

Conversation

olcai
Copy link
Contributor

@olcai olcai commented Jan 16, 2023

When trace logs are downloaded, a zip file is created containing all requested trace logs. After the client has downloaded the zip file, the gathered files need to be deleted. This PR implements file deletion and also creates a unique directory so that concurrent downloads doesn't interfere with each other.

Fixes EMQX-8470.

PR Checklist

Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:

  • Added tests for the changes
  • Changed lines covered in coverage report
  • Change log has been added to changes/<version>/(feat|fix)-<PR-id>.en.md and .zh.md files
  • For internal contributor: there is a jira ticket to track this change
  • If there should be document changes, a PR to emqx-docs.git is sent, or a jira ticket is created to follow up
  • Schema changes are backward compatible

@sstrigler sstrigler marked this pull request as ready for review January 17, 2023 10:13
@sstrigler sstrigler requested review from a team, lafirest and sstrigler as code owners January 17, 2023 10:13
@sstrigler sstrigler marked this pull request as draft January 17, 2023 10:13
@olcai olcai force-pushed the delete-zip-file-from-trace-log-download branch from d390cf5 to f3c98a2 Compare January 17, 2023 10:41
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 3938431170

  • 7 of 7 (100.0%) changed or added relevant lines in 1 file are covered.
  • 38 unchanged lines in 12 files lost coverage.
  • Overall coverage decreased (-0.03%) to 80.036%

Files with Coverage Reduction New Missed Lines %
apps/emqx_machine/src/emqx_machine.erl 1 79.31%
apps/emqx_management/src/emqx_mgmt_api_trace.erl 1 86.49%
apps/emqx/src/emqx_banned.erl 1 89.39%
apps/emqx/src/emqx_broker.erl 1 84.07%
apps/emqx/src/emqx_logger.erl 1 80.49%
apps/emqx/src/emqx_router_helper.erl 1 86.27%
apps/emqx/src/emqx_channel.erl 2 86.8%
apps/emqx/src/emqx_stats.erl 2 91.67%
apps/emqx/src/emqx_flapping.erl 3 80.85%
apps/emqx_management/src/emqx_mgmt_cli.erl 5 27.43%
Totals Coverage Status
Change from base Build 3938154282: -0.03%
Covered Lines: 23120
Relevant Lines: 28887

💛 - Coveralls

We only deleted the resulting zip after a trace file download, not the
actual trace files. This adds a deletion of the uncompressed trace files
as well. It also creates unique directories when collecting trace files
so that concurrent downloads doesn't overwrite files in transit.
@olcai olcai force-pushed the delete-zip-file-from-trace-log-download branch from f3c98a2 to 784e9ad Compare January 17, 2023 13:24
@olcai olcai marked this pull request as ready for review January 17, 2023 13:26
@olcai olcai force-pushed the delete-zip-file-from-trace-log-download branch from 784e9ad to 111268a Compare January 17, 2023 13:33
@olcai olcai force-pushed the delete-zip-file-from-trace-log-download branch from 111268a to 2cf2970 Compare January 17, 2023 14:27
lafirest
lafirest previously approved these changes Jan 17, 2023
thalesmg
thalesmg previously approved these changes Jan 17, 2023
apps/emqx_management/src/emqx_mgmt_api_trace.erl Outdated Show resolved Hide resolved
@olcai olcai dismissed stale reviews from thalesmg and lafirest via 4218227 January 18, 2023 09:22
@olcai olcai merged commit 46fc69c into emqx:master Jan 18, 2023
@olcai olcai deleted the delete-zip-file-from-trace-log-download branch January 18, 2023 12:05
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.

None yet

4 participants