Add OpenTelemetry tracing and log correlation
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
)
|
||||
|
||||
type ServerConfig struct {
|
||||
@@ -18,7 +20,7 @@ type ServerConfig struct {
|
||||
func Run(ctx context.Context, cfg ServerConfig, handler http.Handler) error {
|
||||
server := &http.Server{
|
||||
Addr: fmt.Sprintf("%s:%d", cfg.Host, cfg.Port),
|
||||
Handler: handler,
|
||||
Handler: otelhttp.NewHandler(handler, "gl-dashboard"),
|
||||
ReadHeaderTimeout: cfg.ReadHeaderTimeout,
|
||||
}
|
||||
serveErr := make(chan error, 1)
|
||||
|
||||
Reference in New Issue
Block a user