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 database monitor #3934

Merged
merged 33 commits into from Sep 18, 2023
Merged

add database monitor #3934

merged 33 commits into from Sep 18, 2023

Conversation

sakcer
Copy link
Contributor

@sakcer sakcer commented Sep 15, 2023

🤖 Generated by Copilot at 1846fe2

Summary

🗄️🚀🔐

This pull request adds a new service/database module to the sealos project, which provides a REST API for querying metrics from a VictoriaMetrics cluster. It includes the code, tests, configuration, documentation, Dockerfile and Kubernetes manifests for the service. It also updates the GitHub workflow and the go.work file to include the new module.

service/database
Adding modules and configs
Winter of metrics

Walkthrough

  • Add the service/database module to the project, which provides a REST API for querying metrics from Prometheus or VictoriaMetrics servers (link, link, link)
  • Implement the service/database/api package, which defines the types and constants for the REST API requests and responses (link)
  • Implement the service/database/auth package, which authenticates the user's namespace and kubeconfig against the Kubernetes API server (link)
  • Implement the service/database/request package, which sends HTTP requests to the Prometheus or VictoriaMetrics server and parses the responses (link)
  • Implement the service/database/server package, which loads and parses the server config file and creates and runs the server (link, link)
  • Add a Dockerfile for building the service/database binary and creating a minimal image based on gcr.io/distroless/static:nonroot (link)
  • Add a Makefile for building, testing and pushing the service/database image using the IMG variable (link)
  • Add a README.md file for the service/database directory, which describes the purpose, usage and license of the service (link)
  • Add a config.yml file for the service/database/config package, which specifies the server address for the service (link)
  • Add a deploy directory for the service/database module, which contains the Kubernetes resources for deploying the service and the VictoriaMetrics components (link, link, link, link, link, link, link, link)
  • Add a README.md file for the service/database/deploy directory, which explains how to build and deploy the service using Docker or Kubernetes (link)

@pull-request-size
Copy link

Whoa! Easy there, Partner!

This PR is too big. Please break it up into smaller PRs.

@sealos-ci-robot
Copy link
Member

sealos-ci-robot commented Sep 15, 2023

🤖 Generated by lychee action

Summary

Status Count
🔍 Total 931
✅ Successful 391
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 539
❓ Unknown 0
🚫 Errors 0

Full action output

Full Github Actions output

@codecov
Copy link

codecov bot commented Sep 15, 2023

Codecov Report

Patch has no changes to coverable lines.

📢 Thoughts on this report? Let us know!.

Comment on lines 16 to 17
type PromMetric struct {
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

why use this empty struct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it can be deleted

Comment on lines 141 to 147
go ps.Authenticate(errChan1, pr)
go ps.DBReq(resChan, errChan2, pr)

err1 := <-errChan1
err2 := <-errChan2
res := <-resChan

Copy link
Collaborator

Choose a reason for hiding this comment

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

Adjust the logic to prevent excessive db queries due to failed authentication

@lingdie lingdie merged commit b20966b into labring:main Sep 18, 2023
38 of 39 checks passed
bxy4543 pushed a commit to bxy4543/sealos that referenced this pull request Oct 13, 2023
* add: restserver for database monitor

* add: victoriaMetrics for database monitor

* Delete req.go.bak

* fix: change database monitor server directory

* Update vmstorage.yaml

* fix: blocks without displaying an error

* fix: database monitor

* Update services.yml

* fix: database monitor

* fix: database monitor

* fix: database monitor

* fix: database monitor

* fix: database monitor

* fix: database monitor

* Update go.work

* Update vmagent.yaml

* Update vmagent.yaml

* Update vminsert.yaml

* Update vmselect.yaml

* Update vmstorage.yaml

* fix: database monitor

* fix: database monitor

* fix: database monitor

* fix: database monitor

* fix: database monitor

* fix: authentication and query

* fix: authentication and query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants