File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 66 "log"
77 "net/http"
88 "sort"
9+ "strings"
910 "time"
1011
1112 "github.com/GetStream/tikv-ui/pkg/types"
@@ -65,11 +66,14 @@ func (m *Monitor) pollStores(ctx context.Context) {
6566 log .Printf ("pd metrics: no active cluster name" )
6667 return
6768 }
68-
69+ storesURL := pdAddr + "/pd/api/v1/stores"
70+ if ! strings .HasPrefix (pdAddr , "http" ) {
71+ storesURL = "http://" + pdAddr + "/pd/api/v1/stores"
72+ }
6973 req , err := http .NewRequestWithContext (
7074 ctx ,
7175 http .MethodGet ,
72- "http://" + pdAddr + "/pd/api/v1/stores" ,
76+ storesURL ,
7377 nil ,
7478 )
7579 if err != nil {
@@ -137,7 +141,10 @@ func (m *Monitor) pollTiKVMetrics(ctx context.Context) {
137141 continue
138142 }
139143
140- metricsURL := "http://" + statusAddr + "/metrics"
144+ metricsURL := statusAddr + "/metrics"
145+ if ! strings .HasPrefix (statusAddr , "http" ) {
146+ metricsURL = "http://" + statusAddr + "/metrics"
147+ }
141148 newMetrics , err := m .fetchNodeMetrics (ctx , metricsURL , statusAddr )
142149 if err != nil {
143150 log .Printf ("tikv metrics: node %s error: %v" , statusAddr , err )
You can’t perform that action at this time.
0 commit comments