-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
45 lines (38 loc) · 1.09 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
package main
import (
"log"
"os"
"github.com/hashicorp/terraform-plugin-sdk/plugin"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/liquidweb/terraform-provider-liquidweb/liquidweb"
opentracing "github.com/opentracing/opentracing-go"
"github.com/uber/jaeger-client-go"
jaegercfg "github.com/uber/jaeger-client-go/config"
jaegerlog "github.com/uber/jaeger-client-go/log"
metrics "github.com/uber/jaeger-lib/metrics"
)
func main() {
log.Printf("Tracing enabled: %t", os.Getenv("JAEGER_DISABLED") == "false")
cfg, err := jaegercfg.FromEnv()
cfg.ServiceName = "terraform-provider-liquidweb"
cfg.Sampler = &jaegercfg.SamplerConfig{
Type: jaeger.SamplerTypeConst,
Param: 1,
}
jLogger := jaegerlog.StdLogger
jMetricsFactory := metrics.NullFactory
tracer, closer, err := cfg.NewTracer(
jaegercfg.Logger(jLogger),
jaegercfg.Metrics(jMetricsFactory),
)
if err != nil {
log.Panic(err)
}
opentracing.SetGlobalTracer(tracer)
defer closer.Close()
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: func() terraform.ResourceProvider {
return liquidweb.Provider()
},
})
}