MCPcopy
hub / github.com/prometheus/prometheus / readQueryLog

Function readQueryLog

cmd/prometheus/query_log_test.go:438–451  ·  view source on GitHub ↗

readQueryLog unmarshal a json-formatted query log into query log lines.

(t *testing.T, path string)

Source from the content-addressed store, hash-verified

436
437// readQueryLog unmarshal a json-formatted query log into query log lines.
438func readQueryLog(t *testing.T, path string) []queryLogLine {
439 ql := []queryLogLine{}
440 file, err := os.Open(path)
441 require.NoError(t, err)
442 defer file.Close()
443
444 scanner := bufio.NewScanner(file)
445 for scanner.Scan() {
446 var q queryLogLine
447 require.NoError(t, json.Unmarshal(scanner.Bytes(), &q))
448 ql = append(ql, q)
449 }
450 return ql
451}
452
453// waitForQueryLog waits for the query log to contain at least minEntries entries,
454// polling at regular intervals until the timeout is reached.

Callers 2

runMethod · 0.85
waitForQueryLogFunction · 0.85

Calls 3

CloseMethod · 0.65
BytesMethod · 0.65
UnmarshalMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…