Skip to content

Commit

Permalink
[CORE-1198] Add a timeout to loki requests from debug dump (#8329)
Browse files Browse the repository at this point in the history
* loki timeout and line num change

* move timout to debug dump server
  • Loading branch information
Armaan Varadaraj committed Oct 31, 2022
1 parent 781958d commit a856def
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/internal/lokiutil/lokiutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
const (
// maxLogMessages is the maximum number of log messages the loki server
// will send us, it will error if this is made higher.
maxLogMessages = 5000
maxLogMessages = 2000
)

func forEachLine(resp loki.QueryResponse, f func(t time.Time, line string) error) error {
Expand Down
3 changes: 3 additions & 0 deletions src/server/debug/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,9 @@ func (s *debugServer) collectPipelineDumpFunc(limit int64) collectPipelineFunc {
}
if s.env.Config().LokiHost != "" {
if err := s.forEachWorkerLoki(ctx, pipelineInfo, func(pod string) error {
// Loki requests can hang if the size of the log lines is too big, so we set a timeout
ctx, cancel := context.WithTimeout(ctx, 60*time.Second)
defer cancel()
workerPrefix := join(podPrefix, pod)
if len(prefix) > 0 {
workerPrefix = join(prefix[0], workerPrefix)
Expand Down

0 comments on commit a856def

Please sign in to comment.