0.2.63 update

This commit is contained in:
ponzischeme89
2026-08-14 11:47:32 +12:00
parent 9a8ecbdceb
commit 06b6490ac9
41 changed files with 921 additions and 179 deletions
+39 -1
View File
@@ -153,6 +153,30 @@ func (s *Server) publishAdmin(ctx context.Context, event adminevents.Event) {
s.adminEvents.Publish(ctx, event)
}
func (s *Server) sonarrEnabled(ctx context.Context) bool {
if s.sonarr == nil || s.store == nil {
return false
}
policy, err := s.store.ArrIntegrationPolicy(ctx)
if err != nil {
s.loggerFor(ctx).Warn("arr integration policy read failed", "error", err)
return false
}
return policy.SonarrEnabled
}
func (s *Server) radarrEnabled(ctx context.Context) bool {
if s.radarr == nil || s.store == nil {
return false
}
policy, err := s.store.ArrIntegrationPolicy(ctx)
if err != nil {
s.loggerFor(ctx).Warn("arr integration policy read failed", "error", err)
return false
}
return policy.RadarrEnabled
}
func (s *Server) Routes() http.Handler {
// The client API lives on its own mux so maintenance mode can gate all of it at
// once, without the gate ever touching health checks or the admin page.
@@ -404,6 +428,9 @@ func (s *Server) withLogging(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
r, identity := withRequestIdentity(r)
w.Header().Set("X-Memby-Correlation", identity.correlation)
s.loggerFor(r.Context()).Log(r.Context(), serverlogging.LevelTrace, "request started",
"method", r.Method, "path", r.URL.Path, "query_keys", queryKeys(r))
rec := &statusRecorder{ResponseWriter: w, status: http.StatusOK}
next.ServeHTTP(rec, r)
// Polling the live-log endpoint must not create another live-log record and
@@ -417,7 +444,7 @@ func (s *Server) withLogging(next http.Handler) http.Handler {
//
// Path only: query strings can carry image tokens.
level := requestLogLevel(r.URL.Path, rec.status)
fields := []any{"component", identity.component}
fields := []any{"component", identity.component, "correlation", identity.correlation}
fields = append(fields, identity.viewerAttrs()...)
// The app build keeps its placeholder where the viewer does not, because "which
// build made this call" always has an answer worth seeing, including "it did
@@ -439,6 +466,17 @@ func (s *Server) withLogging(next http.Handler) http.Handler {
})
}
// queryKeys is diagnostic context without values: query values can contain title searches,
// tokens or other private values, while their keys are enough to explain the route shape.
func queryKeys(r *http.Request) string {
keys := make([]string, 0, len(r.URL.Query()))
for key := range r.URL.Query() {
keys = append(keys, key)
}
slices.Sort(keys)
return strings.Join(keys, ",")
}
func clientLogValue(value string) string {
if value == "" {
return "unknown"