MCPcopy Create free account
hub / github.com/AdRoll/baker / print

Method print

output/stats.go:196–231  ·  view source on GitHub ↗
(w io.Writer)

Source from the content-addressed store, hash-verified

194}
195
196func (s *timestampStats) print(w io.Writer) error {
197 csvw := csv.NewWriter(w)
198 if err := csvw.Write(
199 []string{
200 "num timestamps (valid+invalid+empty)",
201 "num errors",
202 "num empty",
203 "first",
204 "1st %%ile", "5th %%ile", "10th %%ile", "25th %%ile", "50th %%ile", "75th %%ile", "90th %%ile", "95th %%ile", "99th %%ile",
205 "last",
206 }); err != nil {
207 return err
208 }
209
210 if err := csvw.Write([]string{
211 fmt.Sprintf("%v", s.qt.Count()),
212 fmt.Sprintf("%v", s.nerrors),
213 fmt.Sprintf("%v", s.nempties),
214 fmt.Sprintf("%v", time.Unix(s.first, 0).UTC()),
215 fmt.Sprintf("%v", time.Unix(int64(s.qt.Query(0.01)), 0).UTC()),
216 fmt.Sprintf("%v", time.Unix(int64(s.qt.Query(0.05)), 0).UTC()),
217 fmt.Sprintf("%v", time.Unix(int64(s.qt.Query(0.1)), 0).UTC()),
218 fmt.Sprintf("%v", time.Unix(int64(s.qt.Query(0.25)), 0).UTC()),
219 fmt.Sprintf("%v", time.Unix(int64(s.qt.Query(0.5)), 0).UTC()),
220 fmt.Sprintf("%v", time.Unix(int64(s.qt.Query(0.75)), 0).UTC()),
221 fmt.Sprintf("%v", time.Unix(int64(s.qt.Query(0.90)), 0).UTC()),
222 fmt.Sprintf("%v", time.Unix(int64(s.qt.Query(0.95)), 0).UTC()),
223 fmt.Sprintf("%v", time.Unix(int64(s.qt.Query(0.99)), 0).UTC()),
224 fmt.Sprintf("%v", time.Unix(s.last, 0).UTC()),
225 }); err != nil {
226 return err
227 }
228
229 csvw.Flush()
230 return csvw.Error()
231}
232
233// The Stats output gathers statistics about the sizes of log lines it sees.
234type Stats struct {

Callers

nothing calls this directly

Calls 3

WriteMethod · 0.45
FlushMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected