MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / buildSummary

Function buildSummary

tests/loadtest/tools/queue_benchmark.go:343–521  ·  view source on GitHub ↗
(cfg benchmarkConfig, start, end snapshot, samples []snapshot)

Source from the content-addressed store, hash-verified

341}
342
343func buildSummary(cfg benchmarkConfig, start, end snapshot, samples []snapshot) map[string]interface{} {
344 durationMs := end.timestamp.Sub(start.timestamp).Seconds() * 1000
345 if durationMs < 0 {
346 durationMs = 0
347 }
348
349 processed := maxInt(0, end.processedTotal-start.processedTotal)
350 failed := maxInt(0, end.failedTotal-start.failedTotal)
351 successes := maxInt(0, processed-failed)
352 failRate := rate(failed, processed)
353 requestRate := counterRate(processed, durationMs)
354 latencySeries := collectLatencySeries(samples)
355 latencyStats := trendStats(latencySeries)
356 queueSizeStats := trendStats(collectIntSeries(samples, func(s snapshot) int { return s.size }))
357 queueDepthStats := trendStats(collectIntSeries(samples, func(s snapshot) int {
358 return s.pending + s.active + s.scheduled + s.retry + s.aggregating
359 }))
360 drained := isDrained(end)
361
362 metrics := map[string]interface{}{
363 fmt.Sprintf("http_req_failed{scenario:%s}", cfg.label): metric{
364 Type: "rate",
365 Contains: "default",
366 Values: map[string]interface{}{
367 "rate": failRate,
368 "passes": float64(successes),
369 "fails": float64(failed),
370 },
371 Thresholds: map[string]interface{}{
372 "rate<0.001": map[string]interface{}{"ok": failRate < 0.001},
373 },
374 },
375 "http_req_failed": metric{
376 Type: "rate",
377 Contains: "default",
378 Values: map[string]interface{}{
379 "rate": failRate,
380 "passes": float64(successes),
381 "fails": float64(failed),
382 },
383 },
384 "http_req_duration": metric{
385 Type: "trend",
386 Contains: "time",
387 Values: latencyStats,
388 },
389 "http_req_duration{expected_response:true}": metric{
390 Type: "trend",
391 Contains: "time",
392 Values: latencyStats,
393 },
394 fmt.Sprintf("http_req_duration{scenario:%s,expected_response:true}", cfg.label): metric{
395 Type: "trend",
396 Contains: "time",
397 Values: latencyStats,
398 },
399 "http_reqs": metric{
400 Type: "counter",

Callers 1

writeCurrentSummaryFunction · 0.85

Calls 11

maxIntFunction · 0.85
rateFunction · 0.85
counterRateFunction · 0.85
collectLatencySeriesFunction · 0.85
trendStatsFunction · 0.85
collectIntSeriesFunction · 0.85
isDrainedFunction · 0.85
boolRateFunction · 0.85
boolCountFunction · 0.85
singleValueTrendFunction · 0.85
boolIntFunction · 0.85

Tested by

no test coverage detected