Files
geo/server/internal/tenant/app/monitoring_worker_runtime.go
T
root e8f48c6d37 refactor(monitoring): consolidate workers and extract to scheduler process
Remove standalone lease-recovery, received-inspection, and result-recovery
workers from tenant-api (now handled by scheduler process). Add configurable
concurrency to ingest and projection-rebuild workers via MonitoringWorkers
runtime config. Extract shared runtime types for worker configuration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:19:57 +08:00

45 lines
941 B
Go

package app
import (
"go.uber.org/zap"
"github.com/geo-platform/tenant-api/internal/shared/response"
)
func normalizeMonitoringWorkerError(err error) error {
if err == nil {
return nil
}
if appErr, ok := err.(*response.AppError); ok {
return appErr
}
return err
}
func monitoringWorkerErrorFields(err error) []zap.Field {
normalized := normalizeMonitoringWorkerError(err)
if normalized == nil {
return nil
}
if appErr, ok := normalized.(*response.AppError); ok {
fields := []zap.Field{
zap.String("error_code", appErr.Message),
zap.Int("app_code", appErr.Code),
}
if appErr.Detail != "" {
fields = append(fields, zap.String("detail", appErr.Detail))
}
if appErr.Cause != nil {
fields = append(fields, zap.Error(appErr.Cause))
}
return fields
}
return []zap.Field{zap.Error(normalized)}
}
func MonitoringWorkerErrorFields(err error) []zap.Field {
return monitoringWorkerErrorFields(err)
}