Skip to content

Commit

Permalink
move to latest madmin and minio-go release (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Apr 9, 2020
1 parent 4acdc44 commit b9c65a3
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 21 deletions.
12 changes: 6 additions & 6 deletions cli/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func runBench(ctx *cli.Context, b bench.Benchmark) error {
fileName = fmt.Sprintf("%s-%s-%s-%s", appName, ctx.Command.Name, time.Now().Format("2006-01-02[150405]"), cID)
}

prof, err := startProfiling(ctx)
prof, err := startProfiling(ctx2, ctx)
fatalIf(probe.NewError(err), "Unable to start profile.")
monitor.Infoln("Starting benchmark in", time.Until(tStart).Round(time.Second), "...")
pgDone = make(chan struct{})
Expand Down Expand Up @@ -229,7 +229,7 @@ func runBench(ctx *cli.Context, b bench.Benchmark) error {
<-pgDone
ops.SortByStartTime()
ops.SetClientID(cID)
prof.stop(ctx, fileName+".profiles.zip")
prof.stop(ctx2, ctx, fileName+".profiles.zip")

f, err := os.Create(fileName + ".csv.zst")
if err != nil {
Expand Down Expand Up @@ -436,7 +436,7 @@ type runningProfiles struct {
client *madmin.AdminClient
}

func startProfiling(ctx *cli.Context) (*runningProfiles, error) {
func startProfiling(ctx2 context.Context, ctx *cli.Context) (*runningProfiles, error) {
prof := ctx.String("serverprof")
if len(prof) == 0 {
return nil, nil
Expand All @@ -445,21 +445,21 @@ func startProfiling(ctx *cli.Context) (*runningProfiles, error) {
r.client = newAdminClient(ctx)

// Start profile
_, cmdErr := r.client.StartProfiling(madmin.ProfilerType(prof))
_, cmdErr := r.client.StartProfiling(ctx2, madmin.ProfilerType(prof))
if cmdErr != nil {
return nil, cmdErr
}
console.Infoln("Server profiling successfully started.")
return &r, nil
}

func (rp *runningProfiles) stop(ctx *cli.Context, fileName string) {
func (rp *runningProfiles) stop(ctx2 context.Context, ctx *cli.Context, fileName string) {
if rp == nil || rp.client == nil {
return
}

// Ask for profile data, which will come compressed with zip format
zippedData, adminErr := rp.client.DownloadProfilingData()
zippedData, adminErr := rp.client.DownloadProfilingData(ctx2)
fatalIf(probe.NewError(adminErr), "Unable to download profile data.")
defer zippedData.Close()

Expand Down
5 changes: 3 additions & 2 deletions cli/benchserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package cli

import (
"context"
"errors"
"fmt"
"net/url"
Expand Down Expand Up @@ -151,7 +152,7 @@ func runServerBenchmark(ctx *cli.Context) (bool, error) {

const benchmarkWait = 3 * time.Second

prof, err := startProfiling(ctx)
prof, err := startProfiling(context.Background(), ctx)
if err != nil {
return true, err
}
Expand All @@ -168,7 +169,7 @@ func runServerBenchmark(ctx *cli.Context) (bool, error) {
if fileName == "" {
fileName = fmt.Sprintf("%s-%s-%s-%s", appName, "remote", time.Now().Format("2006-01-02[150405]"), pRandASCII(4))
}
prof.stop(ctx, fileName+".profiles.zip")
prof.stop(context.Background(), ctx, fileName+".profiles.zip")

infoLn("Done. Downloading operations...")
downloaded := conns.downloadOps()
Expand Down
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ require (
github.com/dustin/go-humanize v1.0.0
github.com/fatih/color v1.7.0
github.com/gorilla/websocket v1.4.1
github.com/klauspost/compress v1.9.7
github.com/klauspost/compress v1.10.3
github.com/minio/cli v1.22.0
github.com/minio/mc v0.0.0-20200201185513-ac9b9423973b
github.com/minio/minio v0.0.0-20200204012747-e934c3e2a270
github.com/minio/minio-go/v6 v6.0.51-0.20200319192131-097caa7760c7
github.com/minio/minio v0.0.0-20200409163002-f44cfb2863a1
github.com/minio/minio-go/v6 v6.0.52
github.com/pkg/profile v1.3.0
github.com/posener/complete v1.2.2-0.20190702141536-6ffe496ea953
github.com/secure-io/sio-go v0.3.0
github.com/shirou/gopsutil v2.20.2+incompatible // indirect
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 // indirect
)
Loading

0 comments on commit b9c65a3

Please sign in to comment.