@@ -33,6 +33,7 @@ import (
3333 "sync/atomic"
3434 "time"
3535
36+ ctrdlog "github.com/containerd/containerd/log"
3637 pb "github.com/ease-lab/vhive/examples/protobuf/helloworld"
3738 log "github.com/sirupsen/logrus"
3839 "google.golang.org/grpc"
@@ -44,7 +45,7 @@ import (
4445var (
4546 completed int64
4647 latSlice LatencySlice
47- port int
48+ portFlag * int
4849 withTracing * bool
4950)
5051
@@ -53,12 +54,24 @@ func main() {
5354 rps := flag .Int ("rps" , 1 , "Target requests per second" )
5455 runDuration := flag .Int ("time" , 5 , "Run the benchmark for X seconds" )
5556 latencyOutputFile := flag .String ("latf" , "lat.csv" , "CSV file for the latency measurements in microseconds" )
56- portFlag : = flag .Int ("port" , 80 , "The port to use for all function invokations " )
57+ portFlag = flag .Int ("port" , 80 , "The port that functions listen to " )
5758 withTracing = flag .Bool ("trace" , false , "Enable tracing in the client" )
5859 zipkin := flag .String ("zipkin" , "http://localhost:9411/api/v2/spans" , "zipkin url" )
60+ debug := flag .Bool ("dbg" , false , "Enable debug logging" )
5961
6062 flag .Parse ()
61- port = * portFlag
63+
64+ log .SetFormatter (& log.TextFormatter {
65+ TimestampFormat : ctrdlog .RFC3339NanoFixed ,
66+ FullTimestamp : true ,
67+ })
68+ log .SetOutput (os .Stdout )
69+ if * debug {
70+ log .SetLevel (log .DebugLevel )
71+ log .Debug ("Debug logging is enabled" )
72+ } else {
73+ log .SetLevel (log .InfoLevel )
74+ }
6275
6376 log .Info ("Reading the URLs from the file: " , * urlFile )
6477
@@ -68,7 +81,10 @@ func main() {
6881 }
6982
7083 if * withTracing {
71- shutdown := tracing .InitBasicTracer (* zipkin , "invoker" )
84+ shutdown , err := tracing .InitBasicTracer (* zipkin , "invoker" )
85+ if err != nil {
86+ log .Print (err )
87+ }
7288 defer shutdown ()
7389 }
7490
@@ -122,9 +138,8 @@ func runBenchmark(urls []string, runDuration, targetRPS int) (realRPS float64) {
122138func invokeFunction (url string ) {
123139 defer getDuration (startMeasurement (url )) // measure entire invocation time
124140
125- address := fmt .Sprintf ("%s:%d" , url , port )
126-
127- fmt .Printf ("Address used: %v\n " , address )
141+ address := fmt .Sprintf ("%s:%d" , url , * portFlag )
142+ log .Debug ("Invoking by the address: %v" , address )
128143
129144 var conn * grpc.ClientConn
130145 var err error
0 commit comments