-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
53 lines (46 loc) · 903 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"context"
"flag"
"fmt"
"strings"
)
const tracerName = "github.com/komuw/otero"
func main() {
var service string
flag.StringVar(
&service,
"service",
"",
"service to run")
flag.Parse()
service = strings.ToLower(service)
if service == "" {
panic("specify a service")
}
ctx := context.Background()
serviceName := fmt.Sprintf("otero-svc-%s", strings.ToUpper(service))
{
tp, err := setupTracing(ctx, serviceName)
if err != nil {
panic(err)
}
defer func() {
err := tp.Shutdown(ctx)
fmt.Println("error when shutting down tracingProvider. err: ", err)
}()
mp, err := setupMetrics(ctx, serviceName)
if err != nil {
panic(err)
}
defer func() {
err := mp.Shutdown(ctx)
fmt.Println("error when shutting down metricsProvider. err: ", err)
}()
}
if service == "a" {
serviceA(ctx, 8081)
} else {
serviceB(ctx, 8082)
}
}