Skip to content

Commit c84e43b

Browse files
committed
adding changes from git merge
1 parent b633c74 commit c84e43b

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed

cmd/kperf/commands/runner/runner.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@ package runner
33
import (
44
"context"
55
"encoding/json"
6+
"flag"
67
"fmt"
78
"os"
89
"path/filepath"
10+
"strconv"
911

1012
"github.com/Azure/kperf/api/types"
1113
"github.com/Azure/kperf/request"
1214

1315
"github.com/urfave/cli"
1416
"gopkg.in/yaml.v2"
17+
"k8s.io/klog/v2"
1518
)
1619

1720
// Command represents runner subcommand.
@@ -72,8 +75,26 @@ var runCommand = cli.Command{
7275
Name: "raw-data",
7376
Usage: "write ResponseStats to file in .json format",
7477
},
78+
cli.StringFlag{
79+
Name: "v",
80+
Usage: "log level for V logs",
81+
Value: "0",
82+
},
7583
},
7684
Action: func(cliCtx *cli.Context) error {
85+
// initialize klog
86+
klog.InitFlags(nil)
87+
88+
vFlag, err := strconv.Atoi(cliCtx.String("v"))
89+
if err != nil || vFlag < 0 {
90+
return fmt.Errorf("invalid value \"%v\" for flag -v: value must be a non-negative integer", cliCtx.String("v"))
91+
}
92+
if err := flag.Set("v", strconv.Itoa(cliCtx.Int("v"))); err != nil {
93+
return fmt.Errorf("failed to set log level: %w", err)
94+
}
95+
defer klog.Flush()
96+
flag.Parse()
97+
7798
profileCfg, err := loadConfig(cliCtx)
7899
if err != nil {
79100
return err
@@ -162,7 +183,6 @@ func loadConfig(cliCtx *cli.Context) (*types.LoadProfile, error) {
162183
}
163184

164185
func printResponseStats(f *os.File, rawDataFlagIncluded bool, stats *request.Result) error {
165-
166186
output := types.RunnerMetricReport{
167187
Total: stats.Total,
168188
FailureList: stats.FailureList,

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require (
1111
k8s.io/apimachinery v0.28.4
1212
k8s.io/cli-runtime v0.28.4
1313
k8s.io/client-go v0.28.4
14+
k8s.io/klog/v2 v2.100.1
1415
k8s.io/kubectl v0.28.4
1516
)
1617

@@ -135,7 +136,6 @@ require (
135136
k8s.io/apiextensions-apiserver v0.28.4 // indirect
136137
k8s.io/apiserver v0.28.4 // indirect
137138
k8s.io/component-base v0.28.4 // indirect
138-
k8s.io/klog/v2 v2.100.1 // indirect
139139
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
140140
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
141141
oras.land/oras-go v1.2.4 // indirect
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
apiVersion: v1,
23
"name": "virtualnodes",
34
"version": "0.0.1"
45
}

manifests/virtualcluster/nodes/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ""
1+
name: "vc-testing"
22
controllerNodeSelectors: {}
33
replicas: 0
44
nodeLabels: {}

request/schedule.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
"golang.org/x/time/rate"
1414
"k8s.io/client-go/rest"
15+
"k8s.io/klog/v2"
1516
)
1617

1718
const defaultTimeout = 60 * time.Second
@@ -55,7 +56,10 @@ func Schedule(ctx context.Context, spec *types.LoadProfileSpec, restCli []rest.I
5556
for builder := range reqBuilderCh {
5657
_, req := builder.Build(cli)
5758

59+
klog.V(9).Infof("Request URL: %s", req.URL())
60+
5861
if err := limiter.Wait(ctx); err != nil {
62+
klog.V(9).Infof("Rate limiter wait failed: %v", err)
5963
cancel()
6064
return
6165
}
@@ -77,6 +81,7 @@ func Schedule(ctx context.Context, spec *types.LoadProfileSpec, restCli []rest.I
7781

7882
if err != nil {
7983
respMetric.ObserveFailure(err)
84+
klog.V(9).Infof("Request stream failed: %v", err)
8085
}
8186
}()
8287
}

0 commit comments

Comments
 (0)