MCPcopy Create free account
hub / github.com/ccusage/ccusage / load_rows

Function load_rows

rust/crates/ccusage/src/adapter/all/loader.rs:20–271  ·  view source on GitHub ↗
(kind: AgentReportKind, shared: &SharedArgs)

Source from the content-addressed store, hash-verified

18};
19
20pub(super) fn load_rows(kind: AgentReportKind, shared: &SharedArgs) -> Result<AllLoadResult> {
21 let mut progress = crate::progress::UsageLoadProgress::new(
22 crate::log_level() != Some(0)
23 && crate::progress::should_show_usage_load_progress(
24 shared.json,
25 crate::progress::usage_load_output_is_tty(),
26 ),
27 );
28 let pricing = PricingMap::load_with_overrides(
29 shared.offline,
30 crate::log_level() != Some(0),
31 shared.pricing_overrides.iter(),
32 );
33 let load_kind = match kind {
34 AgentReportKind::Session => AgentReportKind::Session,
35 AgentReportKind::Daily | AgentReportKind::Weekly | AgentReportKind::Monthly => {
36 AgentReportKind::Daily
37 }
38 };
39 let loader_shared = SharedArgs {
40 json: true,
41 ..shared.clone()
42 };
43 let loaded = load_agent_rows_parallel(
44 vec![
45 AgentLoadSpec {
46 index: 0,
47 agent: "claude",
48 progress_agent: crate::progress::UsageLoadAgent::Claude,
49 load: Box::new(|| load_claude_rows(load_kind, &loader_shared)),
50 },
51 AgentLoadSpec {
52 index: 1,
53 agent: "codex",
54 progress_agent: crate::progress::UsageLoadAgent::Codex,
55 load: Box::new(|| load_codex_rows(load_kind, &loader_shared, &pricing)),
56 },
57 AgentLoadSpec {
58 index: 2,
59 agent: "opencode",
60 progress_agent: crate::progress::UsageLoadAgent::OpenCode,
61 load: Box::new(|| {
62 load_summary_agent_rows(
63 "opencode",
64 load_kind,
65 &loader_shared,
66 || opencode::loader::load_entries(&loader_shared),
67 opencode::summarize_entries,
68 )
69 }),
70 },
71 AgentLoadSpec {
72 index: 3,
73 agent: "amp",
74 progress_agent: crate::progress::UsageLoadAgent::Amp,
75 load: Box::new(|| {
76 load_priced_summary_agent_rows(
77 "amp",

Callers 1

runFunction · 0.85

Calls 7

log_levelFunction · 0.85
usage_load_output_is_ttyFunction · 0.85
load_agent_rows_parallelFunction · 0.85
append_agent_rowsFunction · 0.85
sort_rowsFunction · 0.85
aggregate_rowsFunction · 0.85

Tested by

no test coverage detected