From eb8a2617a788ef78b3a42c84ccae2e5a80161045 Mon Sep 17 00:00:00 2001 From: Kristina Demeshchik Date: Wed, 7 Jan 2026 13:22:36 -0500 Subject: [PATCH] improve loggers --- .../dashboard/pkg/migration/conversion/metrics.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/dashboard/pkg/migration/conversion/metrics.go b/apps/dashboard/pkg/migration/conversion/metrics.go index 9cbdec193e8..c840081cd3d 100644 --- a/apps/dashboard/pkg/migration/conversion/metrics.go +++ b/apps/dashboard/pkg/migration/conversion/metrics.go @@ -76,29 +76,38 @@ func convertAPIVersionToFuncName(apiVersion string) string { // It optionally runs a data loss check function after successful conversion func withConversionMetrics(sourceVersionAPI, targetVersionAPI string, conversionFunc func(a, b interface{}, scope conversion.Scope) error) func(a, b interface{}, scope conversion.Scope) error { return func(a, b interface{}, scope conversion.Scope) error { - // Extract dashboard UID and schema version from source + // Extract dashboard UID, title, and schema version from source var dashboardUID string + var dashboardTitle string var sourceSchemaVersion interface{} var targetSchemaVersion interface{} - // Try to extract UID and schema version from source dashboard + // Try to extract UID, title, and schema version from source dashboard // Only track schema versions for v0/v1 dashboards (v2+ info is redundant with API version) switch source := a.(type) { case *dashv0.Dashboard: dashboardUID = source.Name if source.Spec.Object != nil { sourceSchemaVersion = schemaversion.GetSchemaVersion(source.Spec.Object) + if title, ok := source.Spec.Object["title"].(string); ok { + dashboardTitle = title + } } case *dashv1.Dashboard: dashboardUID = source.Name if source.Spec.Object != nil { sourceSchemaVersion = schemaversion.GetSchemaVersion(source.Spec.Object) + if title, ok := source.Spec.Object["title"].(string); ok { + dashboardTitle = title + } } case *dashv2alpha1.Dashboard: dashboardUID = source.Name + dashboardTitle = source.Spec.Title // Don't track schema version for v2+ (redundant with API version) case *dashv2beta1.Dashboard: dashboardUID = source.Name + dashboardTitle = source.Spec.Title // Don't track schema version for v2+ (redundant with API version) } @@ -167,6 +176,7 @@ func withConversionMetrics(sourceVersionAPI, targetVersionAPI string, conversion "targetVersionAPI", targetVersionAPI, "erroredConversionFunc", getErroredConversionFunc(err), "dashboardUID", dashboardUID, + "dashboardTitle", dashboardTitle, } // Add schema version fields only if we have them (v0/v1 dashboards) @@ -227,6 +237,7 @@ func withConversionMetrics(sourceVersionAPI, targetVersionAPI string, conversion "sourceVersionAPI", sourceVersionAPI, "targetVersionAPI", targetVersionAPI, "dashboardUID", dashboardUID, + "dashboardTitle", dashboardTitle, } // Add schema version fields only if we have them (v0/v1 dashboards)