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

feat: add inspect report subcommand and embed queries as SQL scripts #2246

Merged
merged 39 commits into from
May 21, 2024

Conversation

encima
Copy link
Contributor

@encima encima commented May 6, 2024

What kind of change does this PR introduce?

Chore: split queries out into embedded SQL scripts
Feature: add an inspect db report subcommand that runs all queries and saves their output to CSV files in the current directory

What is the current behavior?

Queries currently stored inside a go submodule

What is the new behavior?

Embedded SQL scripts and report subcommand for inspect that runs all queries and saves their output to the current directory as CSV files

Additional context

Add any other context or screenshots.

@encima encima requested a review from a team as a code owner May 6, 2024 14:54
@coveralls
Copy link

coveralls commented May 6, 2024

Pull Request Test Coverage Report for Build 8985859965

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 2 of 68 (2.94%) changed or added relevant lines in 21 files are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.3%) to 57.204%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/inspect/bloat/bloat.go 0 1 0.0%
internal/inspect/blocking/blocking.go 0 1 0.0%
internal/inspect/calls/calls.go 0 1 0.0%
internal/inspect/index_sizes/index_sizes.go 0 1 0.0%
internal/inspect/index_usage/index_usage.go 0 1 0.0%
internal/inspect/locks/locks.go 0 1 0.0%
internal/inspect/long_running_queries/long_running_queries.go 0 1 0.0%
internal/inspect/outliers/outliers.go 0 1 0.0%
internal/inspect/replication_slots/replication_slots.go 0 1 0.0%
internal/inspect/role_connections/role_connections.go 0 1 0.0%
Files with Coverage Reduction New Missed Lines %
internal/gen/keys/keys.go 5 11.76%
Totals Coverage Status
Change from base Build 8971086947: -0.3%
Covered Lines: 6392
Relevant Lines: 11174

💛 - Coveralls

@KevinBrolly
Copy link
Member

LGTM but still needs review from CLI team 👍

Copy link
Contributor

@sweatybridge sweatybridge left a comment

Choose a reason for hiding this comment

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

Adding a reports command is nice. Apart from those review comments, another suggestion is to wrap all queries in a transaction so they are measuring the same state of the db.

internal/inspect/utils.go Outdated Show resolved Hide resolved
internal/inspect/utils.go Outdated Show resolved Hide resolved
internal/inspect/utils.go Outdated Show resolved Hide resolved
internal/inspect/utils.go Outdated Show resolved Hide resolved
Co-authored-by: Han Qiao <sweatybridge@gmail.com>
@encima
Copy link
Contributor Author

encima commented May 7, 2024

Adding a reports command is nice. Apart from those review comments, another suggestion is to wrap all queries in a transaction so they are measuring the same state of the db.

This is certainly possible, although the current state is not time critical in my mind. The report is useful for insights and debugging but not realtime insights. It could be useful to remove more time-sensitive queries (like locks) from the command

dependabot bot and others added 18 commits May 13, 2024 14:44
Bumps [tar](https://github.com/isaacs/node-tar) from 7.0.1 to 7.1.0.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v7.0.1...v7.1.0)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…58.0 (#2241)

chore(deps): bump github.com/golangci/golangci-lint

Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.57.2 to 1.58.0.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](golangci/golangci-lint@v1.57.2...v1.58.0)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.19.0 to 0.20.0.
- [Commits](golang/term@v0.19.0...v0.20.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.19.0 to 0.20.0.
- [Commits](golang/oauth2@v0.19.0...v0.20.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/gin-gonic/gin](https://github.com/gin-gonic/gin) from 1.9.1 to 1.10.0.
- [Release notes](https://github.com/gin-gonic/gin/releases)
- [Changelog](https://github.com/gin-gonic/gin/blob/master/CHANGELOG.md)
- [Commits](gin-gonic/gin@v1.9.1...v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/gin-gonic/gin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 5 to 6.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](golangci/golangci-lint-action@v5...v6)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore: clean up db pull implementation

* chore: update unit tests
…58.1 (#2256)

chore(deps): bump github.com/golangci/golangci-lint

Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.58.0 to 1.58.1.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](golangci/golangci-lint@v1.58.0...v1.58.1)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
….26.2 (#2257)

chore(deps): bump github.com/charmbracelet/bubbletea

Bumps [github.com/charmbracelet/bubbletea](https://github.com/charmbracelet/bubbletea) from 0.26.1 to 0.26.2.
- [Release notes](https://github.com/charmbracelet/bubbletea/releases)
- [Commits](charmbracelet/bubbletea@v0.26.1...v0.26.2)

---
updated-dependencies:
- dependency-name: github.com/charmbracelet/bubbletea
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
sweatybridge and others added 7 commits May 13, 2024 14:45
…6.1.2+incompatible (#2261)

chore(deps): bump github.com/docker/cli

Bumps [github.com/docker/cli](https://github.com/docker/cli) from 26.1.1+incompatible to 26.1.2+incompatible.
- [Commits](docker/cli@v26.1.1...v26.1.2)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…2262)

Bumps [github.com/containers/common](https://github.com/containers/common) from 0.58.2 to 0.58.3.
- [Release notes](https://github.com/containers/common/releases)
- [Commits](containers/common@v0.58.2...v0.58.3)

---
updated-dependencies:
- dependency-name: github.com/containers/common
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…o 26.1.2+incompatible (#2263)

chore(deps): bump github.com/docker/docker

Bumps [github.com/docker/docker](https://github.com/docker/docker) from 26.1.1+incompatible to 26.1.2+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](moby/moby@v26.1.1...v26.1.2)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@encima
Copy link
Contributor Author

encima commented May 16, 2024

Failing only on tests about table sizes and record counts, oddly.

@sweatybridge sweatybridge changed the title Add inspect db report subcommand and embed queries as SQL scripts feat: add inspect report subcommand and embed queries as SQL scripts May 21, 2024
@sweatybridge sweatybridge merged commit ee621c5 into develop May 21, 2024
12 checks passed
@sweatybridge sweatybridge deleted the feat/extract-sql branch May 21, 2024 12:39
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

8 participants