-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
55 lines (46 loc) · 1.23 KB
/
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
54
55
package main
import (
"fmt"
"os"
"runtime/debug"
"jeager1/grpcB"
"jeager1/httpA"
"jeager1/natsC"
"github.com/kokizzu/gotro/S"
)
func GetVersion() string {
if info, ok := debug.ReadBuildInfo(); ok {
return S.TrimChars(info.Deps[len(info.Deps)-1].Version, `()`) // importing binary always on the last of Deps
}
return `unknown`
}
var DEPLOY_ENV = `development`
func main() {
fmt.Println(debug.ReadBuildInfo())
if len(os.Args) <= 1 {
fmt.Println(`usage:
` + os.Args[0] + ` httpA|grpcB|natsC`)
return
}
// https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/jaeger
// environment variables used:
/*
OTEL_EXPORTER_JAEGER_AGENT_HOST WithAgentHost localhost
OTEL_EXPORTER_JAEGER_AGENT_PORT WithAgentPort 6831
OTEL_EXPORTER_JAEGER_ENDPOINT WithEndpoint http://localhost:14268/api/traces
OTEL_EXPORTER_JAEGER_USER WithUsername
OTEL_EXPORTER_JAEGER_PASSWORD WithPassword
*/
mode := os.Args[1]
switch mode {
case `httpA`:
server := httpA.HttpA{}
server.StartServer(DEPLOY_ENV, mode, GetVersion())
case `grpcB`:
server := grpcB.GrpcB{}
server.StartServer(DEPLOY_ENV, mode, GetVersion())
case `natsC`:
server := natsC.NatsC{}
server.StartServer(DEPLOY_ENV, mode, GetVersion())
}
}