75 lines
2.5 KiB
Protocol Buffer
75 lines
2.5 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package state.v1;
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
service StatsService {
|
|
rpc StatusCounts(StatusCountsRequest) returns (StatusCountsResponse);
|
|
rpc WorkflowStats(WorkflowStatsRequest) returns (WorkflowStatsResponse);
|
|
rpc StageStats(StageStatsRequest) returns (StageStatsResponse);
|
|
rpc TokensByDay(TokensByDayRequest) returns (TokensByDayResponse);
|
|
rpc UsageTotals(UsageTotalsRequest) returns (UsageTotalsResponse);
|
|
}
|
|
|
|
// WorkflowStat mirrors storecontract.WorkflowStat.
|
|
message WorkflowStat {
|
|
string workflow = 1;
|
|
int64 runs = 2;
|
|
int64 merged = 3;
|
|
int64 pr_open = 4;
|
|
int64 parked = 5;
|
|
int64 avg_tokens = 6;
|
|
double avg_steps = 7;
|
|
int64 total_tokens = 8;
|
|
int64 completed = 9;
|
|
// running and last_status describe the newest runs, so a workflow whose
|
|
// runs are older than a global task page still reports its real state.
|
|
int64 running = 10;
|
|
string last_status = 11;
|
|
// last_run_id and last_run_at name the newest run and when it was created.
|
|
int64 last_run_id = 12;
|
|
google.protobuf.Timestamp last_run_at = 13;
|
|
}
|
|
// StageStat mirrors storecontract.StageStat.
|
|
message StageStat {
|
|
string workflow = 1;
|
|
string stage = 2;
|
|
int64 runs = 3;
|
|
int64 avg_ms = 4;
|
|
int64 errors = 5;
|
|
}
|
|
// DayTokens mirrors storecontract.DayTokens.
|
|
message DayTokens {
|
|
string day = 1;
|
|
int64 tokens = 2;
|
|
}
|
|
message StatusCountsRequest {}
|
|
message StatusCountsResponse { map<string, int64> counts = 1; }
|
|
message WorkflowStatsRequest {}
|
|
message WorkflowStatsResponse { repeated WorkflowStat stats = 1; }
|
|
message StageStatsRequest {}
|
|
message StageStatsResponse { repeated StageStat stats = 1; }
|
|
message TokensByDayRequest { int64 days = 1; }
|
|
message TokensByDayResponse { repeated DayTokens tokens = 1; }
|
|
|
|
// UsageTotalRow is one cell of a model-usage report: the day, source,
|
|
// provider, model and identity the calls belong to, and the tokens they
|
|
// used. Cost is not carried: the reader prices the tokens against the model
|
|
// catalog, so a price change is a change of interpretation, not of history.
|
|
message UsageTotalRow {
|
|
string day = 1;
|
|
string source = 2;
|
|
string provider = 3;
|
|
string model = 4;
|
|
// identity is who the work was requested as, empty when unknown.
|
|
string identity = 5;
|
|
int64 calls = 6;
|
|
int64 input_tokens = 7;
|
|
int64 output_tokens = 8;
|
|
int64 cached_tokens = 9;
|
|
}
|
|
// UsageTotalsRequest names the range ending now, in days.
|
|
message UsageTotalsRequest { int64 days = 1; }
|
|
message UsageTotalsResponse { repeated UsageTotalRow rows = 1; }
|