Skip to content

Commit 6dfa46c

Browse files
committed
fix(elasticsearch): replace placeholder comments with selflog error handling
1 parent 1ed2c30 commit 6dfa46c

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

sinks/elasticsearch.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func (es *ElasticsearchSink) sendBulkRequest(body []byte) bool {
288288
}
289289

290290
if err := json.NewDecoder(resp.Body).Decode(&result); err == nil {
291-
// Log any individual errors (in production, you'd handle these appropriately)
291+
// Log individual document errors using selflog
292292
if result.Errors {
293293
for _, item := range result.Items {
294294
// Check both index and create responses
@@ -309,23 +309,23 @@ func (es *ElasticsearchSink) sendBulkRequest(body []byte) bool {
309309
}
310310

311311
if errorInfo != nil {
312-
// Individual document error - could log or handle
312+
// Log individual document error
313313
if selflog.IsEnabled() {
314314
errType := errorInfo["type"]
315315
errReason := errorInfo["reason"]
316316
selflog.Printf("[elasticsearch] bulk item error: type=%v, reason=%v", errType, errReason)
317317
}
318-
// In production, you might want to retry failed documents
319-
// For now, increment a counter or log the error
320-
continue // Skip to next item
321318
}
322319
}
323320
}
324321
}
325322
return true
326323
}
327324

328-
// Read error response for debugging (in production, you might log this)
325+
// Log HTTP error response for debugging
326+
if selflog.IsEnabled() {
327+
selflog.Printf("[elasticsearch] HTTP %d response from %s", resp.StatusCode, bulkURL)
328+
}
329329
}
330330

331331
return false

0 commit comments

Comments
 (0)