MCPcopy Create free account
hub / github.com/PaperDebugger/paperdebugger / trackHourlyUsage

Method trackHourlyUsage

internal/services/usage.go:166–173  ·  view source on GitHub ↗
(ctx context.Context, userID bson.ObjectID, projectID string, cost float64, success bool, now time.Time)

Source from the content-addressed store, hash-verified

164}
165
166func (s *UsageService) trackHourlyUsage(ctx context.Context, userID bson.ObjectID, projectID string, cost float64, success bool, now time.Time) error {
167 filter := bson.M{
168 "user_id": userID,
169 "project_id": projectID,
170 "hour_bucket": bson.NewDateTimeFromTime(models.TruncateToHour(now)),
171 }
172 return s.upsertUsage(ctx, s.hourlyCollection, filter, cost, success, now)
173}
174
175func (s *UsageService) trackWeeklyUsage(ctx context.Context, userID bson.ObjectID, projectID string, cost float64, success bool, now time.Time) error {
176 filter := bson.M{

Callers 1

TrackUsageMethod · 0.95

Calls 2

upsertUsageMethod · 0.95
TruncateToHourFunction · 0.92

Tested by

no test coverage detected