package main import ( "fmt" "log" "maal/tracer/pkg/tracer" "os" "os/signal" "time" "github.com/gofiber/fiber/v2" "go.opentelemetry.io/otel/trace" ) func main() { main := fiber.New(fiber.Config{ StreamRequestBody: true, }) main.Use(tracer.NewTracer(tracer.Config{ AppName: "test", JaegerUrl: "http://localhost:4318/v1/traces", GelfUrl: "192.168.220.30:12001", Version: "1", })) defer tracer.ShutdownTracer() main.Get("/", func(c *fiber.Ctx) error { _, span := tracer.Handler(c) defer span.End() span.AddEvent("xd", trace.WithTimestamp(time.Now())) _, span = tracer.Handler(c) defer span.End() return c.SendString("xd") }) // handle interrupts (shutdown) c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt) go func() { oscall := <-c log.Printf("system call: %+v", oscall) main.Shutdown() }() if err := main.Listen(fmt.Sprintf(":%d", 3344)); err != nil { log.Panic(err) } fmt.Println("Shutting down...") }