Bound Distributor response diagnostics

This commit is contained in:
2026-08-13 02:55:25 +00:00
parent 0b57d99a97
commit 4b748c2e53
10 changed files with 497 additions and 46 deletions

View File

@@ -81,7 +81,7 @@ func notifyBatch(ctx context.Context, cfg config.Config, batch BatchKind, runID
batchResult := batchNotificationResult(req, notification)
if wrappedErr != nil {
batchResult.Status = "failed"
batchResult.Error = wrappedErr.Error()
batchResult.Error = safeDistributorNotificationFailure(wrappedErr)
return batchResult
}
return batchResult
@@ -233,7 +233,7 @@ func batchNotificationResult(req batchNotificationRequest, result *NotificationR
notification.IdempotencyKey = result.IdempotencyKey
}
if result.Error != "" {
notification.Error = result.Error
notification.Error = safeDistributorRunError(result.Error)
}
}
if notification.Status == "" {
@@ -246,11 +246,18 @@ func failedBatchNotificationResult(req batchNotificationRequest, err error) *Bat
notification := batchNotificationResult(req, nil)
notification.Status = "failed"
if err != nil {
notification.Error = err.Error()
notification.Error = safeDistributorNotificationFailure(err)
}
return notification
}
func safeDistributorNotificationFailure(err error) string {
if err == nil {
return ""
}
return "distributor notification failed"
}
func renderBatchNotificationIdentity(cfg config.Config, batch BatchKind, runID string, startedAt time.Time) (batchNotificationIdentity, error) {
values, err := batchNotificationTemplateValues(cfg, batch, runID, startedAt)
if err != nil {