Keep run logs opaque and streamline transfers
This commit is contained in:
@@ -82,14 +82,14 @@ func TailDeclaredFileLogSource(ctx context.Context, workspaceRoot string, assign
|
||||
return lifecycleFailure("log_source_seek_failed", err.Error())
|
||||
}
|
||||
}
|
||||
reader := bufio.NewReader(file)
|
||||
reader := bufio.NewReaderSize(file, 64*1024)
|
||||
for {
|
||||
// A newline only frames an entry. Every other byte, including CR, blank
|
||||
// lines, and arbitrarily long output, remains untouched.
|
||||
line, readErr := reader.ReadString('\n')
|
||||
line, readErr := reader.ReadSlice('\n')
|
||||
if len(line) > 0 {
|
||||
checkpoint.Sequence++
|
||||
if err := sink.Append(ctx, assignment, source.StreamKey, strings.TrimSuffix(line, "\n")); err != nil {
|
||||
if err := sink.Append(ctx, assignment, source.StreamKey, strings.TrimSuffix(string(line), "\n")); err != nil {
|
||||
return lifecycleFailure("log_source_sink_failed", err.Error())
|
||||
}
|
||||
checkpoint.SourceKey = source.Key
|
||||
@@ -97,7 +97,7 @@ func TailDeclaredFileLogSource(ctx context.Context, workspaceRoot string, assign
|
||||
checkpoint.CursorRef = fmt.Sprintf("artifact://jobs/%s/live-log-checkpoint", url.PathEscape(assignment.JobID))
|
||||
store.PutLogCheckpoint(checkpoint)
|
||||
}
|
||||
if readErr == nil {
|
||||
if readErr == nil || readErr == bufio.ErrBufferFull {
|
||||
continue
|
||||
}
|
||||
if readErr == io.EOF {
|
||||
@@ -116,7 +116,7 @@ func TailDeclaredFileLogSource(ctx context.Context, workspaceRoot string, assign
|
||||
}
|
||||
}
|
||||
|
||||
func RedactedLogCheckpointSummary(checkpoint LogSourceCheckpoint) string {
|
||||
func LogCheckpointSummary(checkpoint LogSourceCheckpoint) string {
|
||||
return strings.Join([]string{
|
||||
"source=" + checkpoint.SourceKey,
|
||||
fmt.Sprintf("offset=%d", checkpoint.Offset),
|
||||
|
||||
Reference in New Issue
Block a user