@@ -100,12 +100,29 @@ parameters:
100100 - apiversion: Use API version from context
101101 - routename: Use route name from metadata (default)
102102 - constant: Use a static string value (requires 'key' field)
103- enum : ["header", "metadata", "ip", "apiname", "apiversion", "routename", "constant"]
103+ - cel: Use CEL expression to extract key (requires 'expression' field)
104+ enum : ["header", "metadata", "ip", "apiname", "apiversion", "routename", "cel", "constant"]
104105 key :
105106 type : string
106107 description : Header name or metadata key (required for header/metadata types)
107108 minLength : 1
108109 maxLength : 256
110+ expression :
111+ type : string
112+ description : |
113+ CEL expression for key extraction (required for cel type).
114+ The expression must return a string value.
115+ Available variables:
116+ - request.Headers: map[string][]string of request headers
117+ - request.Path: string, the request path
118+ - request.Method: string, the HTTP method
119+ - request.Metadata: map[string]any, shared metadata
120+ - api.Name: string, API name
121+ - api.Version: string, API version
122+ - api.Context: string, API context path
123+ Example: 'request.Headers["x-user-id"][0] + ":" + api.Name'
124+ minLength : 1
125+ maxLength : 1024
109126
110127 costExtraction :
111128 type : object
@@ -147,8 +164,11 @@ parameters:
147164 - response_header: Extract from response header (post-response)
148165 - response_metadata: Extract from response metadata (post-response)
149166 - response_body: Extract from JSON response body using jsonPath (post-response)
167+ - request_cel: Use CEL expression to extract cost from request context (pre-request)
168+ - response_cel: Use CEL expression to extract cost from response context (post-response)
150169 enum : ["request_header", "request_metadata", "request_body",
151- " response_header" , "response_metadata", "response_body"]
170+ " response_header" , "response_metadata", "response_body",
171+ " request_cel" , "response_cel"]
152172
153173 key :
154174 type : string
@@ -167,6 +187,29 @@ parameters:
167187 minLength : 1
168188 maxLength : 512
169189
190+ expression :
191+ type : string
192+ description : |
193+ CEL expression for cost extraction (required for request_cel/response_cel types).
194+ The expression must return a numeric value (int or double).
195+ Available variables for request_cel:
196+ - request.Headers: map[string][]string of request headers
197+ - request.Body: request body bytes (if buffered)
198+ - request.Path: string, the request path
199+ - request.Method: string, the HTTP method
200+ - request.Metadata: map[string]any, shared metadata
201+ Available variables for response_cel:
202+ - response.Headers: map[string][]string of response headers
203+ - response.Body: response body bytes (if buffered)
204+ - response.Status: int, response status code
205+ - request.Headers: map[string][]string of original request headers
206+ - request.Path: string, the original request path
207+ - request.Method: string, the original HTTP method
208+ - request.Metadata: map[string]any, shared metadata
209+ Example: 'int(request.Headers["x-token-count"][0])'
210+ minLength : 1
211+ maxLength : 1024
212+
170213 multiplier :
171214 type : number
172215 description : |
@@ -210,12 +253,29 @@ parameters:
210253 - apiversion: Use API version from context
211254 - routename: Use route name from metadata (default)
212255 - constant: Use a static string value (requires 'key' field)
213- enum : ["header", "metadata", "ip", "apiname", "apiversion", "routename", "constant"]
256+ - cel: Use CEL expression to extract key (requires 'expression' field)
257+ enum : ["header", "metadata", "ip", "apiname", "apiversion", "routename", "cel", "constant"]
214258 key :
215259 type : string
216260 description : Header name or metadata key (required for header/metadata types)
217261 minLength : 1
218262 maxLength : 256
263+ expression :
264+ type : string
265+ description : |
266+ CEL expression for key extraction (required for cel type).
267+ The expression must return a string value.
268+ Available variables:
269+ - request.Headers: map[string][]string of request headers
270+ - request.Path: string, the request path
271+ - request.Method: string, the HTTP method
272+ - request.Metadata: map[string]any, shared metadata
273+ - api.Name: string, API name
274+ - api.Version: string, API version
275+ - api.Context: string, API context path
276+ Example: 'request.Headers["x-user-id"][0] + ":" + api.Name'
277+ minLength : 1
278+ maxLength : 1024
219279
220280 onRateLimitExceeded :
221281 type : object
0 commit comments