lab6: OpenTelemetry (traces, metrics, logs), Collector, Prometheus, Loki, Tempo, Grafana; перенос trace context через outbox и AMQP

This commit is contained in:
2026-11-12 12:10:30 +03:00
parent 470d9d6f1e
commit 010739d9fa
118 changed files with 15009 additions and 3 deletions
@@ -0,0 +1,18 @@
package middleware
import (
"context"
"net/http"
"time"
)
// Timeout ограничивает время выполнения запроса.
func Timeout(d time.Duration) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx, cancel := context.WithTimeout(r.Context(), d)
defer cancel()
next.ServeHTTP(w, r.WithContext(ctx))
})
}
}