(domain string, agg *crossRunDomainAgg, runIDs []int64)
| 377 | } |
| 378 | |
| 379 | func buildCrossRunDomainEntry(domain string, agg *crossRunDomainAgg, runIDs []int64) DomainInventoryEntry { |
| 380 | presentRuns := make(map[int64]DomainRunStatus, len(agg.perRun)) |
| 381 | for _, status := range agg.perRun { |
| 382 | presentRuns[status.RunID] = status |
| 383 | } |
| 384 | |
| 385 | fullPerRun := make([]DomainRunStatus, 0, len(runIDs)) |
| 386 | for _, rid := range runIDs { |
| 387 | status, ok := presentRuns[rid] |
| 388 | if !ok { |
| 389 | status = DomainRunStatus{RunID: rid, Status: "absent"} |
| 390 | } |
| 391 | fullPerRun = append(fullPerRun, status) |
| 392 | } |
| 393 | |
| 394 | return DomainInventoryEntry{ |
| 395 | Domain: domain, |
| 396 | SeenInRuns: len(agg.perRun), |
| 397 | TotalAllowed: agg.totalAllowed, |
| 398 | TotalBlocked: agg.totalBlocked, |
| 399 | OverallStatus: classifyFirewallDomainStatus(DomainRequestStats{Allowed: agg.totalAllowed, Blocked: agg.totalBlocked}), |
| 400 | PerRunStatus: fullPerRun, |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | // metricsRawRow holds per-run raw metric values for aggregation. |
| 405 | type metricsRawRow struct { |
no test coverage detected