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

pkg/cluster/spec: add supported configuration for grafana #1566

Merged
merged 3 commits into from
Sep 27, 2021
Merged

pkg/cluster/spec: add supported configuration for grafana #1566

merged 3 commits into from
Sep 27, 2021

Conversation

haiboumich
Copy link
Contributor

@haiboumich haiboumich commented Sep 26, 2021

What problem does this PR solve?

Add default_theme, org_name, org_role as supported configurations for Grafana.

What is changed and how it works?

Add sub-targets under grafana_servers in topology.yaml which is used as the configuration file for tiup-cluster deploy command.
Sample topology.yaml:

global:
  user: "root"
  ssh_port: 22
  deploy_dir: "/root/tidb-deploy"
  data_dir: "/root/tidb-data"
  arch: "amd64"

monitored:
  node_exporter_port: 9100
  blackbox_exporter_port: 9115

pd_servers:
  - host: $HOST_IP

tidb_servers:
  - host: $HOST_IP
    port: 4000
    status_port: 10080
    deploy_dir: "/root/tidb-deploy/tidb-4000"
    log_dir: "/root/tidb-deploy/tidb-4000/log"

tikv_servers:
  - host: $HOST_IP
    port: 20160
    status_port: 20180
    deploy_dir: "/root/data1/tidb-deploy/tikv-20160"
    data_dir: "/root/tidb-data/tikv-20160"
    log_dir: "/root/tidb-deploy/tikv-20160/log"

monitoring_servers:
  - host: $HOST_IP

grafana_servers:
  - host: $HOST_IP
    anonymous_enable: true
    default_theme: light
    org_name: Main Org.
    org_role: Viewer

alertmanager_servers:
  - host: $HOST_IP

Check List

Tests

  • Manual test (add detailed scripts or steps below)
    • Step one
      In Linux environment, run make under the project's root path to generate the binary file in the bin directory
    • Step two
      Run ./tiup-cluster deploy test-tidb v5.1.1 /path/to/topology.yaml and ./tiup-cluster start test-tidb to start a TiDB cluster. You can use the provided sample topology.yaml above, remember to substitute $HOST_IP with yours.
      Also, you may also need to provide credentials by passing -u -p or -u -i in the deploy command, see tiup-cluster deploy -h.
    • Step three
      Open browser and type in $HOST_IP:3000. If you use the provided topology.yaml file above, you should find that you have logged in automatically and the theme is light.
      You can also make sure that the configuration takes effect by checking the value of default_theme, org_name, org_role, enabled in /root/tidb-deploy/grafana-3000/conf/grafana.ini. It should be the same as below.
      # Default UI theme ("dark" or "light")
      default_theme = light
      
      ############### Set Cookie Name for Multiple Instances               
      #######################
      [auth]
      login_cookie_name = grafana_session_3000
      
      #################################### Anonymous Auth        
      ##########################
      [auth.anonymous]
      enabled = true
      
      # specify organization name that should be used for unauthenticated users
      org_name = Main Org.
      
      # specify role for unauthenticated users
      org_role = Viewer

Code changes

Side effects

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release notes:

Add `default_theme`, `org_name`, `org_role` as supported configurations for Grafana

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Sep 26, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • AstroProfundis

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@CLAassistant
Copy link

CLAassistant commented Sep 26, 2021

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 26, 2021
@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2021

Codecov Report

Merging #1566 (a12a9f7) into master (7ad8f97) will increase coverage by 13.40%.
The diff coverage is 100.00%.

❗ Current head a12a9f7 differs from pull request most recent head 5ba2032. Consider uploading reports for the commit 5ba2032 to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##           master    #1566       +/-   ##
===========================================
+ Coverage   26.20%   39.61%   +13.40%     
===========================================
  Files         266      228       -38     
  Lines       24038    21071     -2967     
===========================================
+ Hits         6300     8347     +2047     
+ Misses      16916    11465     -5451     
- Partials      822     1259      +437     
Flag Coverage Δ
cluster 39.61% <100.00%> (?)
integrate 39.61% <100.00%> (+23.79%) ⬆️
tiup ?
unittest ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/cluster/spec/grafana.go 58.94% <100.00%> (+38.67%) ⬆️
pkg/cluster/template/config/grafana.go 84.31% <100.00%> (+84.31%) ⬆️
pkg/utils/regexp.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/repository/store/store.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/telemetry/telemetry.go 0.00% <0.00%> (-83.34%) ⬇️
pkg/repository/utils/hash.go 0.00% <0.00%> (-83.34%) ⬇️
pkg/repository/model/publish.go 0.00% <0.00%> (-83.34%) ⬇️
pkg/repository/store/local.go 0.00% <0.00%> (-82.61%) ⬇️
pkg/utils/semver.go 7.08% <0.00%> (-79.53%) ⬇️
pkg/meta/err.go 0.00% <0.00%> (-77.78%) ⬇️
... and 243 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ad8f97...5ba2032. Read the comment docs.

@haiboumich
Copy link
Contributor Author

/cc @AstroProfundis

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 27, 2021
@AstroProfundis AstroProfundis added category/monitoring Categorizes issue or PR related to monitoring components. component/cluster Issues about the tiup-cluster component labels Sep 27, 2021
@AstroProfundis AstroProfundis added this to the v1.6.0 milestone Sep 27, 2021
@AstroProfundis
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 5ba2032

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 27, 2021
@ti-chi-bot ti-chi-bot merged commit a9a260a into pingcap:master Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category/monitoring Categorizes issue or PR related to monitoring components. component/cluster Issues about the tiup-cluster component first-time-contributor size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants