Dashboards: Fix logging for conversions (#115126)
This commit is contained in:
@@ -488,7 +488,7 @@ func withConversionDataLossDetection(sourceFuncName, targetFuncName string, conv
|
||||
|
||||
// Detect if data was lost
|
||||
if dataLossErr := detectConversionDataLoss(sourceStats, targetStats, sourceFuncName, targetFuncName); dataLossErr != nil {
|
||||
logger.Error("Dashboard conversion data loss detected",
|
||||
getLogger().Error("Dashboard conversion data loss detected",
|
||||
"sourceFunc", sourceFuncName,
|
||||
"targetFunc", targetFuncName,
|
||||
"sourcePanels", sourceStats.panelCount,
|
||||
@@ -504,7 +504,7 @@ func withConversionDataLossDetection(sourceFuncName, targetFuncName string, conv
|
||||
return dataLossErr
|
||||
}
|
||||
|
||||
logger.Debug("Dashboard conversion completed without data loss",
|
||||
getLogger().Debug("Dashboard conversion completed without data loss",
|
||||
"sourceFunc", sourceFuncName,
|
||||
"targetFunc", targetFuncName,
|
||||
"panels", targetStats.panelCount,
|
||||
|
||||
@@ -17,7 +17,9 @@ import (
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/migration/schemaversion"
|
||||
)
|
||||
|
||||
var logger = logging.DefaultLogger.With("logger", "dashboard.conversion")
|
||||
func getLogger() logging.Logger {
|
||||
return logging.DefaultLogger.With("logger", "dashboard.conversion")
|
||||
}
|
||||
|
||||
// getErroredSchemaVersionFunc determines the schema version function that errored
|
||||
func getErroredSchemaVersionFunc(err error) string {
|
||||
@@ -197,9 +199,9 @@ func withConversionMetrics(sourceVersionAPI, targetVersionAPI string, conversion
|
||||
)
|
||||
|
||||
if errorType == "schema_minimum_version_error" {
|
||||
logger.Warn("Dashboard conversion failed", logFields...)
|
||||
getLogger().Warn("Dashboard conversion failed", logFields...)
|
||||
} else {
|
||||
logger.Error("Dashboard conversion failed", logFields...)
|
||||
getLogger().Error("Dashboard conversion failed", logFields...)
|
||||
}
|
||||
} else {
|
||||
// Record success metrics
|
||||
@@ -235,7 +237,7 @@ func withConversionMetrics(sourceVersionAPI, targetVersionAPI string, conversion
|
||||
)
|
||||
}
|
||||
|
||||
logger.Debug("Dashboard conversion succeeded", successLogFields...)
|
||||
getLogger().Debug("Dashboard conversion succeeded", successLogFields...)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user