Add OpenTelemetry tracing and log correlation

This commit is contained in:
2026-09-17 14:56:57 +03:30
parent 3445ead897
commit f7366a1985
9 changed files with 187 additions and 40 deletions
+3 -1
View File
@@ -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)