HourlyUsage tracks cost per user, per project, per hour. Each document represents one hour bucket of usage.
| 9 | // HourlyUsage tracks cost per user, per project, per hour. |
| 10 | // Each document represents one hour bucket of usage. |
| 11 | type HourlyUsage struct { |
| 12 | ID bson.ObjectID `bson:"_id"` |
| 13 | UserID bson.ObjectID `bson:"user_id"` |
| 14 | ProjectID string `bson:"project_id"` |
| 15 | HourBucket bson.DateTime `bson:"hour_bucket"` // Timestamp truncated to the hour |
| 16 | SuccessCost float64 `bson:"success_cost"` // Cost in USD for successful requests |
| 17 | FailedCost float64 `bson:"failed_cost"` // Cost in USD for failed requests |
| 18 | UpdatedAt bson.DateTime `bson:"updated_at"` |
| 19 | } |
| 20 | |
| 21 | func (u HourlyUsage) CollectionName() string { |
| 22 | return "hourly_usages" |
nothing calls this directly
no outgoing calls
no test coverage detected