From 2ee62061f4aac35f7c45c525d6e74e0b5974b822 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 24 May 2023 10:49:16 +0200 Subject: [PATCH] Improve debug info order --- core/api.go | 18 +++++++++++++----- network/api.go | 25 +++++++++++++++++++++---- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/core/api.go b/core/api.go index 24a4b946..be5fffad 100644 --- a/core/api.go +++ b/core/api.go @@ -137,16 +137,24 @@ func debugInfo(ar *api.Request) (data []byte, err error) { di.Style = ar.Request.URL.Query().Get("style") // Add debug information. + + // Very basic information at the start. di.AddVersionInfo() di.AddPlatformInfo(ar.Context()) - status.AddToDebugInfo(di) - config.AddToDebugInfo(di) - resolver.AddToDebugInfo(di) - captain.AddToDebugInfo(di) - compat.AddToDebugInfo(di) + + // Errors and unexpected logs. di.AddLastReportedModuleError() di.AddLastUnexpectedLogs() + + // Status Information from various modules. + status.AddToDebugInfo(di) + captain.AddToDebugInfo(di) + resolver.AddToDebugInfo(di) + config.AddToDebugInfo(di) + + // Detailed information. updates.AddToDebugInfo(di) + compat.AddToDebugInfo(di) di.AddGoroutineStack() // Return data. diff --git a/network/api.go b/network/api.go index aeb43ad7..edb8b661 100644 --- a/network/api.go +++ b/network/api.go @@ -9,12 +9,15 @@ import ( "time" "github.com/safing/portbase/api" + "github.com/safing/portbase/config" "github.com/safing/portbase/database/query" "github.com/safing/portbase/utils/debug" + "github.com/safing/portmaster/compat" "github.com/safing/portmaster/network/state" "github.com/safing/portmaster/process" "github.com/safing/portmaster/resolver" "github.com/safing/portmaster/status" + "github.com/safing/portmaster/updates" ) func registerAPIEndpoints() error { @@ -72,17 +75,31 @@ func debugInfo(ar *api.Request) (data []byte, err error) { di.Style = ar.Request.URL.Query().Get("style") // Add debug information. + + // Very basic information at the start. di.AddVersionInfo() di.AddPlatformInfo(ar.Context()) - status.AddToDebugInfo(di) - resolver.AddToDebugInfo(di) + + // Errors and unexpected logs. + di.AddLastReportedModuleError() + di.AddLastUnexpectedLogs() + + // Network Connections. AddNetworkDebugData( di, ar.Request.URL.Query().Get("profile"), ar.Request.URL.Query().Get("where"), ) - di.AddLastReportedModuleError() - di.AddLastUnexpectedLogs() + + // Status Information from various modules. + status.AddToDebugInfo(di) + // captain.AddToDebugInfo(di) // TODO: Cannot use due to import loop. + resolver.AddToDebugInfo(di) + config.AddToDebugInfo(di) + + // Detailed information. + updates.AddToDebugInfo(di) + compat.AddToDebugInfo(di) di.AddGoroutineStack() // Return data.