Skip to content

Commit

Permalink
tunnel fix
Browse files Browse the repository at this point in the history
Signed-off-by: sayedppqq <[email protected]>
  • Loading branch information
sayedppqq committed Jan 31, 2024
1 parent 2e74647 commit 94c2bc9
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/monitor/connection/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func Run(f cmdutil.Factory, args []string, prom monitor.PromSvc) {
log.Fatal("Enter database and specific database name as argument")
}

database := args[0]
database := monitor.ConvertedResource(args[0])
databaseName := args[1]
namespace, _, err := f.ToRawKubeConfigLoader().Namespace()
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions pkg/monitor/connection/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ package connection
import (
"fmt"
"log"

"kubedb.dev/cli/pkg/monitor"
)

const (
Expand All @@ -45,7 +43,6 @@ func getIdenticalMetrics(database, databaseName string) map[string]*metrics {
func getDBMetrics(database, name string, queries map[string]*metrics) map[string]*metrics {
label := "service"
labelValue := fmt.Sprintf("%s-stats", name)
database = monitor.ConvertedResource(database)
switch database {
case "mongodb":
queries[database] = &metrics{
Expand Down
1 change: 0 additions & 1 deletion pkg/monitor/prometheus_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func GetPromClientAndTunnel(config *rest.Config, prom PromSvc) (promv1.API, *por
if err != nil {
log.Fatal(err)
}
defer tunnel.Close()

promClient := getPromClient(strconv.Itoa(tunnel.Local))
return promClient, tunnel
Expand Down
4 changes: 2 additions & 2 deletions pkg/monitor/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package monitor

import (
"fmt"
"log"
"strings"
)

Expand All @@ -44,7 +44,7 @@ func ConvertedResource(resource string) string {
case "rd", "redis", "redises":
res = "redis"
default:
fmt.Printf("%s is not a valid resource type \n", resource)
log.Fatalf("%s is not a valid resource type \n", resource)
}
return res
}

0 comments on commit 94c2bc9

Please sign in to comment.