MCPcopy
hub / github.com/grafana/tempo / main

Function main

cmd/tempo-query/main.go:31–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29}
30
31func main() {
32 config := zap.NewProductionEncoderConfig()
33 logger := zap.New(zapcore.NewCore(
34 zaplogfmt.NewEncoder(config),
35 os.Stdout,
36 zapcore.InfoLevel,
37 ))
38
39 var configPath string
40 flag.StringVar(&configPath, "config", "", "A path to the plugin's configuration file")
41 flag.Parse()
42
43 v := viper.New()
44 v.AutomaticEnv()
45 v.SetEnvKeyReplacer(strings.NewReplacer("-", "_", ".", "_"))
46
47 if configPath != "" {
48 v.SetConfigFile(configPath)
49
50 err := v.ReadInConfig()
51 if err != nil {
52 logger.Error("failed to parse configuration file", zap.Error(err))
53 }
54 }
55
56 cfg := &tempo.Config{}
57 cfg.InitFromViper(v)
58
59 backend, err := tempo.New(logger, cfg)
60 if err != nil {
61 logger.Error("failed to init tracer backend", zap.Error(err))
62 }
63
64 grpcOpts := []google_grpc.ServerOption{
65 google_grpc.StatsHandler(otelgrpc.NewServerHandler()),
66 }
67
68 if cfg.TLSServerEnabeld {
69 creds, err := credentials.NewClientTLSFromFile(cfg.TLS.CertPath, cfg.TLS.ServerName)
70 if err != nil {
71 logger.Error("failed to load TLS credentials", zap.Error(err))
72 } else {
73 grpcOpts = append(grpcOpts, google_grpc.Creds(creds))
74 }
75 }
76
77 srv := google_grpc.NewServer(grpcOpts...)
78
79 storage_v1.RegisterSpanReaderPluginServer(srv, backend)
80 storage_v1.RegisterDependenciesReaderPluginServer(srv, backend)
81 storage_v1.RegisterSpanWriterPluginServer(srv, backend)
82
83 healthServer := health.NewServer()
84 grpc_health_v1.RegisterHealthServer(srv, healthServer)
85 healthServer.SetServingStatus("", grpc_health_v1.HealthCheckResponse_SERVING)
86
87 lis, err := net.Listen("tcp", cfg.Address)
88 if err != nil {

Callers

nothing calls this directly

Calls 8

InitFromViperMethod · 0.95
NewFunction · 0.92
ParseMethod · 0.65
ErrorMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected