e8f48c6d37
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>
45 lines
941 B
Go
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)
|
|
}
|