Documentation
¶
Overview ¶
Package usage builds cohort reports from retained counts and verified links.
Index ¶
- Constants
- Variables
- func NamespaceUID(ctx context.Context, reader client.Reader, namespace string) (string, error)
- func NamespaceUIDForObject(ctx context.Context, reader client.Reader, object client.Object) (string, error)
- type Measurement
- type OtherWork
- type Page
- type PullRequest
- type Report
- type Retention
- type Summary
- type Task
- type Team
- type Totals
- type Work
Constants ¶
View Source
const ReadinessMaxAge = 10 * time.Minute
Variables ¶
View Source
var ErrTotalsOutOfRange = errors.New("usage totals exceed the supported exact integer range")
Functions ¶
func NamespaceUID ¶
Types ¶
type Measurement ¶
type Measurement struct {
ID string `json:"id"`
AttemptID string `json:"attemptID,omitempty"`
Scope string `json:"scope"`
Source string `json:"source"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
InputTokens *int64 `json:"inputTokens"`
OutputTokens *int64 `json:"outputTokens"`
CachedInputTokens *int64 `json:"cachedInputTokens"`
CacheWriteInputTokens *int64 `json:"cacheWriteInputTokens"`
Status string `json:"status"`
Completeness string `json:"completeness"`
Gap string `json:"gap,omitempty"`
ObservedAt time.Time `json:"observedAt"`
// contains filtered or unexported fields
}
type PullRequest ¶
type PullRequest struct {
store.UsagePullRequest
Origin string `json:"origin"`
EvidenceID string `json:"evidenceID"`
}
type Report ¶
type Report struct {
Selection store.UsageFilter `json:"selection"`
RetainedSince *time.Time `json:"retainedSince,omitempty"`
Summary Summary `json:"summary"`
Teams []Team `json:"teams"`
Works []Work `json:"works"`
OtherWork []OtherWork `json:"otherWork"`
Page *Page `json:"page,omitempty"`
}
type Retention ¶
type Retention struct {
Store store.UsageStore
Period time.Duration
}
Retention expires inactive reporting cohorts independently of Task TTLs.
func (*Retention) NeedLeaderElection ¶
type Summary ¶
type Summary struct {
Totals
WorkRequests int `json:"workRequests"`
UnfinishedWork int `json:"unfinishedWork"`
PRsOpened int `json:"prsOpened"`
PRsReady int `json:"prsReady"`
PRsMerged int `json:"prsMerged"`
PRsClosed int `json:"prsClosed"`
PRsAssisted int `json:"prsAssisted"`
TokensPerPROpened *float64 `json:"tokensPerPROpened"`
TokensPerPRMerged *float64 `json:"tokensPerPRMerged"`
}
type Task ¶
type Task struct {
store.UsageTask
Totals Totals `json:"usage"`
Measurements []Measurement `json:"measurements"`
}
type Totals ¶
type Totals struct {
InputTokens int64 `json:"inputTokens"`
OutputTokens int64 `json:"outputTokens"`
CachedInputTokens int64 `json:"cachedInputTokens"`
CacheWriteInputTokens int64 `json:"cacheWriteInputTokens"`
TotalTokens int64 `json:"totalTokens"`
EstimatedTokens int64 `json:"estimatedTokens"`
CachedUsageReported bool `json:"cachedUsageReported"`
CacheWriteUsageReported bool `json:"cacheWriteUsageReported"`
Measurements int `json:"measurements"`
ReportedMeasurements int `json:"reportedMeasurements"`
MissingMeasurements int `json:"missingMeasurements"`
PartialMeasurements int `json:"partialMeasurements"`
Calls int `json:"calls"`
Attempts int `json:"attempts"`
Completeness string `json:"completeness"`
ModelCost string `json:"modelCost"`
}
type Work ¶
type Work struct {
store.UsageWorkRequest
Summary Summary `json:"summary"`
Tasks []Task `json:"tasks,omitempty"`
PullRequests []PullRequest `json:"pullRequests,omitempty"`
Models []string `json:"models,omitempty"`
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.