Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit e0f401a

Browse files
authored
codygateway: Expose allowed models in limiter status endpoint (#58141)
This adds the set of allowed models to the `GET /v1/limits` API endpoint for feature detection. ## Test plan Verified locally that the endpoint still works and that model names are returned correctly.
1 parent a465ffc commit e0f401a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Diff for: cmd/cody-gateway/internal/httpapi/featurelimiter/featurelimiter.go

+9-7
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,10 @@ func ListLimitsHandler(baseLogger log.Logger, eventLogger events.Logger, redisSt
191191
}
192192

193193
el := listLimitElement{
194-
Limit: rateLimit.Limit,
195-
Interval: rateLimit.Interval.String(),
196-
Usage: int64(currentUsage),
194+
Limit: rateLimit.Limit,
195+
Interval: rateLimit.Interval.String(),
196+
Usage: int64(currentUsage),
197+
AllowedModels: rateLimit.AllowedModels,
197198
}
198199
if !expiry.IsZero() {
199200
el.Expiry = &expiry
@@ -209,10 +210,11 @@ func ListLimitsHandler(baseLogger log.Logger, eventLogger events.Logger, redisSt
209210
}
210211

211212
type listLimitElement struct {
212-
Limit int64 `json:"limit"`
213-
Interval string `json:"interval"`
214-
Usage int64 `json:"usage"`
215-
Expiry *time.Time `json:"expiry,omitempty"`
213+
Limit int64 `json:"limit"`
214+
Interval string `json:"interval"`
215+
Usage int64 `json:"usage"`
216+
Expiry *time.Time `json:"expiry,omitempty"`
217+
AllowedModels []string `json:"allowedModels"`
216218
}
217219

218220
func noopRateLimitNotifier(ctx context.Context, actor codygateway.Actor, feature codygateway.Feature, usageRatio float32, ttl time.Duration) {

0 commit comments

Comments
 (0)