Skip to content

Commit 5583792

Browse files
MBaczunustiugov
authored andcommitted
Refactoring tracing
Signed-off-by: Michal Baczun <[email protected]>
1 parent eccdf35 commit 5583792

File tree

23 files changed

+3041
-471
lines changed

23 files changed

+3041
-471
lines changed

.github/dependabot.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
1+
# Use https://dependabot.com/docs/config-file/validator/ to check for errors.
12
version: 2
23
updates:
34
- package-ecosystem: "gomod"
45
directory: "/"
56
schedule:
67
interval: "weekly"
78

8-
updates:
99
- package-ecosystem: "gomod"
1010
directory: "/function-images/tests/chained-function-serving"
1111
schedule:
1212
interval: "weekly"
13+
1314
- package-ecosystem: "gomod"
1415
directory: "/function-images/tests/chained-function-eventing"
1516
schedule:
1617
interval: "weekly"
18+
1719
- package-ecosystem: "gomod"
1820
directory: "/utils/benchmarking/eventing"
1921
schedule:
2022
interval: "weekly"
21-
updates:
23+
2224
- package-ecosystem: "gomod"
2325
directory: "/utils/tracing/go"
2426
schedule:
2527
interval: "weekly"
28+
29+
- package-ecosystem: "gomod"
30+
directory: "/examples/deployer"
31+
schedule:
32+
interval: "weekly"
33+
34+
- package-ecosystem: "gomod"
35+
directory: "/examples/invoker"
36+
schedule:
37+
interval: "weekly"

.github/workflows/function-composition-push.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ jobs:
7272
uses: docker/setup-buildx-action@v1
7373

7474
- name: Build and push
75-
working-directory: .
75+
working-directory: ./function-images/tests/chained-function-serving
7676
run: |
77-
make serving-all-image
78-
make serving-all-image-push
77+
make all-image
78+
make all-image-push
7979
8080
push-chained-functions-eventing:
8181
name: Push chained-functions-eventing-*

Makefile

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -138,22 +138,5 @@ test-cri:
138138

139139
test-cri-travis: # Testing in travis is deprecated
140140
$(MAKE) -C cri test-travis
141-
142-
serving-all-image: serving-producer-image serving-consumer-image
143-
144-
serving-all-image-push: serving-producer-image-push serving-consumer-image-push
145-
146-
serving-producer-image: ./function-images/tests/chained-function-serving/Dockerfile ./function-images/tests/chained-function-serving/producer/producer.go ./function-images/tests/chained-function-serving/proto/prodcon.pb.go ./function-images/tests/chained-function-serving/proto/prodcon_grpc.pb.go
147-
docker build --tag vhiveease/chained-functions-serving-producer:latest --build-arg target_arg=producer -f ./function-images/tests/chained-function-serving/Dockerfile .
148-
149-
serving-producer-image-push: serving-producer-image
150-
docker push vhiveease/chained-functions-serving-producer:latest
151-
152-
153-
serving-consumer-image: ./function-images/tests/chained-function-serving/Dockerfile ./function-images/tests/chained-function-serving/consumer/consumer.go ./function-images/tests/chained-function-serving/proto/prodcon.pb.go ./function-images/tests/chained-function-serving/proto/prodcon_grpc.pb.go
154-
docker build --tag vhiveease/chained-functions-serving-consumer:latest --build-arg target_arg=consumer -f ./function-images/tests/chained-function-serving/Dockerfile .
155-
156-
serving-consumer-image-push: serving-consumer-image
157-
docker push vhiveease/chained-functions-serving-consumer:latest
158141

159142
.PHONY: test-orch $(SUBDIRS) test-subdirs

configs/.wordlist.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ crccheck
8989
cri
9090
CRI
9191
csv
92+
ctrdlog
9293
Ctrl
9394
Daglis
9495
datacenter
@@ -146,6 +147,7 @@ filesystem
146147
fmt
147148
Frontend
148149
fullstorydev
150+
FullTimestamp
149151
funcNames
150152
FunctionBench
151153
Fytraki
@@ -240,6 +242,7 @@ linux
240242
LLC
241243
loadStep
242244
localhost
245+
logrus
243246
Lorem
244247
Lotfi
245248
lsi
@@ -277,6 +280,7 @@ Nagarajan
277280
namespace
278281
namespaces
279282
namespacing
283+
NanoFixed
280284
nd
281285
Netrace
282286
NEURALWALKER
@@ -386,6 +390,7 @@ Seiculescu
386390
Sep
387391
serverfull
388392
serverless
393+
SetFormatter
389394
SGD
390395
sha
391396
shahab
@@ -426,10 +431,12 @@ TCO
426431
TempReader
427432
TestProfileIncrementConfiguration
428433
TestProfileSingleConfiguration
434+
TextFormatter
429435
th
430436
Timeseries
431437
timeseriesdb
432438
TimeseriesDB
439+
TimestampFormat
433440
TLB
434441
tmp
435442
tmux

docs/adding_benchmarks_guide.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,18 @@ both for code maintenance and in demonstrating how the workload should be deploy
118118
to as an example in which the demo serving and eventing workloads are ran both "locally" and on
119119
a Knative cluster.
120120

121+
### Logging
122+
When including logging within functions, please use `logrus` with the following format:
123+
```
124+
log.SetFormatter(&log.TextFormatter{
125+
TimestampFormat: ctrdlog.RFC3339NanoFixed,
126+
FullTimestamp: true,
127+
})
128+
```
129+
See
130+
[this code snippet](https://github.com/ease-lab/vhive/blob/dfa0d400e17595a5fb0009ec8ab3211b5b4b7f9f/vhive.go#L102)
131+
for an example.
132+
121133
## Serving
122134
To compose functions with serving we make use of the
123135
[Knative Serving component](https://knative.dev/docs/serving/). Each of the functions will

examples/deployer/go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/ease-lab/vhive/examples/deployer
2+
3+
go 1.16
4+
5+
require github.com/sirupsen/logrus v1.8.1

examples/deployer/go.sum

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5+
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
6+
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
7+
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
8+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
9+
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
10+
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

examples/invoker/client.go

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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 (
4445
var (
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) {
122138
func 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

examples/invoker/go.mod

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module github.com/ease-lab/vhive/examples/invoker
2+
3+
go 1.16
4+
5+
replace github.com/ease-lab/vhive/utils/tracing/go => ../../utils/tracing/go
6+
7+
require (
8+
github.com/containerd/containerd v1.5.2
9+
github.com/ease-lab/vhive/examples/protobuf/helloworld v0.0.0-20210621160829-cea81c4fff31
10+
github.com/ease-lab/vhive/utils/tracing/go v0.0.0-00010101000000-000000000000
11+
github.com/sirupsen/logrus v1.8.1
12+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0
13+
google.golang.org/grpc v1.37.0
14+
)

0 commit comments

Comments
 (0)