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

dds stats #624

Merged
Merged

Conversation

i-oden
Copy link
Member

@i-oden i-oden commented Mar 23, 2023

Before submitting this PR

  1. Description: Sometimes we get questions regarding the project- and data statistics on the DDS. At the moment we need to run manual queries in the database for this, which we want to avoid as much as possible, so this is a start to a / temporary command which can get the number of projects (either total or active) or check the total amount of data currently stored in the system. I could've listed the units and gotten the size from there, but that'd mean that a part of this command was only usable by Super Admins, and a part by everyone. Used this for code simplicity.
  2. Jira task / GitHub issue: DDS-1520
  3. How to test: Try the stats command.
  4. Type of change: Check the relevant boxes in the section below
  5. Add docstrings and comments to code, even if you personally think it's obvious.

What type of change(s) does the PR contain?

  • New feature
    • Breaking: Please describe the reason for the break and how we can fix it.
    • Non-breaking
  • Bug fix
    • Breaking: Please describe the reason for the break and how we can fix it.
    • Non-breaking
  • Security Alert fix
  • Documentation
  • Tests (only)
  • Workflow

Checklist

  • Sprintlog
    • Added
    • Not needed (E.g. PR contains only tests)
  • Rebase / Update / Merge from base branch (the branch from which the current is forked)
    • Done
    • Not needed
  • Blocking PRs
    • Merged
    • No blocking PRs
  • PR to master branch

Actions / Scans

  • Black: Python code formatter. Does not execute. Only tests.
    Run black . locally to execute formatting.
    • Passed
  • Prettier: General code formatter. Our use case: MD and yaml mainly.
    Run npx prettier --write . locally to execute formatting.
    • Passed
  • Yamllint: Linting of yaml files.
    • Passed
  • Tests: Pytest to verify that functionality works as expected.
    • New tests added
    • No new tests
    • Passed
  • TestPyPi: Build CLI and publish to TestPyPi in order to verify before release.
    • Passed
  • CodeQL: Scan for security vulnerabilities, bugs, errors
    • New alerts: Go through them and either fix, dismiss och ignore. Add reasoning in items below.
    • Alerts fixed: What?
    • Alerts ignored / dismissed: Why?
    • Passed
  • Trivy: Security scanner
    • New alerts: Go through them and either fix, dismiss och ignore. Add reasoning in items below.
    • Alerts fixed: What?
    • Alerts ignored / dismissed: Why?
    • Passed
  • Snyk: Security scanner
    • New alerts: Go through them and either fix, dismiss och ignore. Add reasoning in items below.
    • Alerts fixed: What?
    • Alerts ignored / dismissed: Why?
    • Passed

@i-oden i-oden self-assigned this Mar 23, 2023
@i-oden i-oden requested a review from valyo March 23, 2023 12:14
@i-oden i-oden marked this pull request as ready for review March 23, 2023 12:14
@codecov
Copy link

codecov bot commented Mar 23, 2023

Codecov Report

Merging #624 (92b7f27) into dev (85de946) will decrease coverage by 0.25%.
The diff coverage is 26.31%.

@@            Coverage Diff             @@
##              dev     #624      +/-   ##
==========================================
- Coverage   46.75%   46.50%   -0.25%     
==========================================
  Files          31       31              
  Lines        2785     2804      +19     
==========================================
+ Hits         1302     1304       +2     
- Misses       1483     1500      +17     
Impacted Files Coverage Δ
dds_cli/__main__.py 41.56% <26.31%> (-0.90%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@valyo valyo left a comment

Choose a reason for hiding this comment

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

Works fine
Comment: it is quite slow, but that's not so important for internal use IMO

@i-oden
Copy link
Member Author

i-oden commented Mar 27, 2023

Works fine Comment: it is quite slow, but that's not so important for internal use IMO

Agreed. We should look at improving the project-listing endpoint at some point, but as you say it's not super important for us and it's a lot slower for superadmins since all the projects are listed.

@i-oden i-oden merged commit 75ed551 into dev Mar 27, 2023
@i-oden i-oden deleted the DDS-1520-add-temporary-super-admin-command-data-statistics branch August 7, 2023 12:24
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.

2 participants