Skip to content

Commit

Permalink
Can't keep track anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
JarcauCristian committed Dec 31, 2023
1 parent abb196f commit d042736
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions helper_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"io"
"net/http"
"os/exec"
"regexp"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -224,13 +223,14 @@ func getTotalBytes(alias []string, token string, fileSize float64) (float64, err

stringBody := string(body)
startIndex := strings.Index(stringBody, "minio_cluster_capacity_raw_free_bytes{server=\"127.0.0.1:9000\"}")
pattern := "[^0-9+e\\-\\.$]"
//pattern := "[^0-9+e\\-\\.$]"

re := regexp.MustCompile(pattern)
processedInput := re.ReplaceAllString(stringBody[startIndex+63:startIndex+63+16], " ")
//processedInput = strings.Replace(processedInput, " ", "", -1)
//re := regexp.MustCompile(pattern)
//processedInput := re.ReplaceAllString(stringBody[startIndex+63:startIndex+63+16], " ")
processedInput := strings.Replace(stringBody[startIndex+63:startIndex+63+16], " ", "", -1)

total, err := strconv.ParseFloat(processedInput, 64)
fmt.Println(processedInput)
fmt.Println(total)

if err != nil {
Expand Down

0 comments on commit d042736

Please sign in to comment.