로그 추가

This commit is contained in:
2025-09-11 18:37:56 +09:00
parent 2d81202b6c
commit 90faa7d681

View File

@ -220,13 +220,26 @@ func (c *Client) sendLoop(ctx context.Context) {
var retry []*singleLogMarshaller
for i, item := range respbody.Items {
if item.Create.Status < 400 {
// 재시도
if item.Create.Status < 300 {
continue
}
if item.Create.Status == 429 || item.Create.Status >= 500 {
logger.Println("[LogStream] send bulk failed but retry. status :", item.Create.Status)
retry = append(retry, logs[i])
} else if item.Create.Status == 400 {
// 구문 오류. 재시도 불가
if i < len(logs) {
logger.Println("[LogStream] send bulk failed. status 400 :", string(logs[i].content))
} else {
logger.Println("[LogStream] send bulk failed. status 400 but out of index :", i, len(logs))
}
} else {
// 일단 로그만
logger.Println("[LogStream] send bulk failed but no retry. status :", item.Create.Status)
}
}
logger.Println("[LogStream] send bulk failed. retry :", len(retry), len(logs), respbody.Items)
if len(retry) > 0 {
failChan <- retry
}